DOM Interfaces

HTMLSelectElement

Represents a selection control with live option collections, selection state and validation. For multiple selection, value returns only the first selected option; use selectedOptions to read the full set. Example result: baku.

Formal Syntax & Structure

html syntaxhtml
const element = document.getElementById('demo'); // HTMLSelectElement

Return Value

HTMLSelectElement

An existing HTML DOM object associated with the select element in this example; this interface is a type, not a function return contract.

Working Example

Example Snippethtml
<label>  City  <select id="demo">    <option value="baku">Baku</option>  </select></label><p>  Result:  <output id="result"></output></p><script>  const e = document.getElementById('demo');  const result = value => { document.getElementById("result").textContent = String(value); };  result(e.value);</script>
HTML Reference