I am looking for simple and short solution of accessing SELECT value on HTML website in Internet Explorers (6 and 7).
HTML
<select id="s1">
<option>Option1</option>
</select>
JS:
document.getElementById("s1").options[document.getElementById("s1").selectedIndex].value
Above code do not work. I get empty strings.
I found one solution – I would have to make every option look like this:
<option value="Option1">Option1</option>
That works but my website mostly cosist of forms, so such operation increase its size by 50-70%.
Do you know any other ways ?
PS. I’ve read that I should use “text” instead of “value”, but I am not sure about that. I couldn’t find what are the consequences of doing this.
Use,