HTML <select>
query_builder | Christopher PisaniThe HTML element <select> is the parent element of <option>. Each <option> holds a pre-defined option for user to choose from a drop-down list.
Example of a common selection drop-down list
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 |
---|---|---|
autofocus | The drop-down list will get focus when page loads. | |
disabled | Disables the entire drop-down options. | |
form | id | The form id to which the drop-down list is linked to. |
multiple | Specifies that multiple options can be selected from the drop-down list | |
name | text | The name assigned to the select drop-down |
required | Specifies that at least one option must be selected from the options. | |
size | number | The number of options visible. The rest of the options will be visible when scrolled inside the list. |