Select
Drop-down list of choices
Demo
API
Tag
Name |
Type |
Content |
select |
Native element |
<option> or <optgroup> children |
optgroup |
Native element |
<option> children |
option |
Native element |
Text |
Attributes
Name |
Value |
Description |
label |
String |
Displayed as the <optgroup> heading. |
value |
String |
Used as the value of the element. |
Note: Not all input attributes are listed here. See MDN: Select element - Attributes for the full list.
Events
Name |
Detail |
Description |
change |
None |
Fired after an option was selected. |
Guidelines
More Autocomplete!
Any select with a dozen or more options could benefit from becoming an Autocomplete. It takes just one more line of code:
Accessibility
Label should use the for
attribute to reference the id of its corresponding select.