Get value of <select> the modern way?
javascript
Solution
`mySelect.value` is a W3C standard at least since October 1st, 1998. See the DOM Level 1 Specification. However, some IE browsers released after that date do not support it, including IE8 (I just tested it).
Edit: As @kennebec pointed out, the issue with IE8 is that it wont use the option's text when there is no value set. If all your options do have a value set, then `myselect.value` will work on IE8.
Problem
I was under the impression that in order to get the value from `<select>` you essentially had to do this: ``` var sel = document.getElementById("my-select"); var val = sel.options[sel.selectedIndex].value; ``` But I ran into some code today that simply does `document.getElementById('my-select').value`, which seems to work perfectly fine in Chrome and Firefox. Has this changed recently, or has it always been this way? How far back is this supported?