HTML <option>
query_builder | Christopher PisaniThe HTML element <option> is the child element of <select>. Each <option> holds a pre-defined answer for user to choose from the drop-down list.
A simple example to better understand this element
Select a town in the UK:
<select>
<option value="nairn">Nairn</option>
<option value="forres">Forres</option>
<option value="elgin">Elgin</option>
<option value="rothes">Rothes</option>
<option value="liverpool">Liverpool</option>
<option value="manchester">Manchester</option>
<option value="essex">Essex</option>
<option value="kent">Kent</option>
</select>
Available Attributes
Attribute | Values | Functionality |
---|---|---|
disabled | Disables the option but still shows dimmed. | |
label | text | Option description can be placed in label attribute or within the element itself. |
selected | Pre-selects an option | |
value | text | Value to use for selection |