HTMLSelectElement: value property

Baseline Widely available

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 element associated with this element, or the empty string if no options are selected.

Examples

Retrieving the selected value

html





js
const logElement = document.querySelector("#log");
function log(text) {
  logElement.innerText = text;
}

const select = document.querySelector("#bird-select");
select.addEventListener("change", () => {
  log(`Selection: ${select.value}`);
});

Specifications

Specification
HTML
# dom-select-value-dev

Browser compatibility

See also