We can’t access the option value using javascript on Internet Explorer using the normal javascript method.ie we cant get the value of the select box in ie

IE is looking for the value attribute. It looks like other browsers are defaulting to the text displayed as the value if value=”” is not found on the option tag. The following is what works on all major browsers.

<form name="myform">
    <select id='select' name="select">
        <option value='one'>one</option>
    var index = document.myform.select.selectedIndex;
    var value = document.myform.select.options[index].value;
    alert(value); // Alerts 'one'

By this code we can get the value of selectbox

Leave a Reply

Your email address will not be published. Required fields are marked *