HTML select.value in "old browsers"
html, html-select, javascript
Solution
`.value` works for me in most oldest browsers supported in windows XP.
<select id="select">
<option value="Hello1">1</option>
<option value="Hello2">2</option>
<option value="Hello3">3</option>
<option value="Hello4">4</option>
<option value="Hello5">5</option>
</select>
JavaScript:
var id = document.getElementById("select");
id.onchange = function(){
alert(this.value);
}
This works on:
(All run from Windows XP)
IE6
Firefox 3.0
Safari 4.0
Chrome 14.0
Opera 10.6
This is as far as Browserstack goes back to.
Problem
UPDATE Unfortunately I have caused some confusion by talking about the `.value` property, but then asking for any reference to feature support in browsers. In hindsight, I guess the thing I needed right now was to know whether `.value` is "safe" to use, and therefore that is why I accepted @BeatAlex's answer (as they put the effort in to actually test on multiple browser. ORIGINAL QUESTION Using javascript, the accepted way to get/set the value of the selected `<option>` in a `<select>` is using the `.value` property. For years and years I have not used the `.value` property, as I was told that "old browsers" don't support it. Instead I use the long form of... ``` dd.options[dd.selectedIndex].value; ``` But I've just done some research, and I cannot find any reference to which "old browsers" this effects. For instance this quirksmode article even mentions "old browsers" but doesn't give any more information than that. Which "old browsers" do not have the `.value` property on the `<select>` element? Is there a reference somewhere to exactly when particular features became available in mainstream browsers? Note: unfortunately jQuery is not currently available to me, due to an old 3rd party component being used on the system