Select
Drop-down list of choices
Demo
Select one
Water
Coke
Lemonade
Select many
Chips & salsa
Cheese platter
Duck confit
8oz aged ribeye
Cake
Ice-cream
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 . If you have all the data, it's just as easy to do as a normal select:
State
Alabama
Alaska
Arizona
Arkansas
California
Colorado
Connecticut
...
South Dakota
Texas
Utah
Vermont
Virginia
Washington
West Virginia
Wisconsin
Wyoming
State
Alabama
Alaska
Arizona
Arkansas
California
Colorado
Connecticut
...
South Dakota
Texas
Utah
Vermont
Virginia
Washington
West Virginia
Wisconsin
Wyoming
Accessibility
Label should use the for
attribute to reference the id of its corresponding select.