This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
The HTMLSelectElement.value property contains the value of the first selected <option> element associated with this <select> element.
This property can also be set directly, for example to set a default value based on some condition.
A string containing the value of the first selected <option> element in this <select> element, or the empty string if no options are selected.
<label for="bird-select">Choose a bird:</label> <select name="birds" id="bird-select"> <option value="">--Please choose an option--</option> <option value="Scarlet ibis">Scarlet ibis</option> <option value="Marabou stork">Marabou stork</option> <option value="Roseate spoonbill">Roseate spoonbill</option> </select> <pre id="log"></pre>
const logElement = document.querySelector("#log");
function log(text) {
logElement.innerText = text;
}
const select = document.querySelector("#bird-select");
select.addEventListener("change", () => {
log(`Selection: ${select.value}`);
});
| Specification |
|---|
| HTML> # dom-select-value-dev> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
value |
1 | 12 | 1 | ≤12.1 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
<select> HTML element, implementing this interface.
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement/value