HTML5 <select> Tag
ExampleCreate a select list with four options:
Try it yourself » |
Definition and Usage
The select element creates a drop-down list.
The <option> tags inside the select element define the available options in the list.
Differences Between HTML 4.01 and HTML5
HTML5 has some new attributes.
Tips and Notes
Tip: The select element is a form control and can be used in a form to collect user input.
Attributes
New : New in HTML5.
Attribute | Value | Description |
---|---|---|
autofocusNew | autofocus | Makes the select field focused on page load |
disabled | disabled | When true, it disables the drop-down list |
formNew | formname | Defines one ore more forms the select field belongs to. |
multiple | multiple | When present, it specifies that multiple items can be selected at a time |
name | unique name | Defines a unique name for the drop-down list |
size | number | Defines the number of visible items in the drop-down list. |
Standard Attributes
The <option> tag also supports the Standard Attributes in HTML5.
Event Attributes
The <option> tag also supports the Event Attributes in HTML5.