HTML <select> Tag
The choose tag generates a dropdown list of values from which the user may select.
A succession of <option>
tags within the <select>
element define the dropdown values. This tag is sometimes referred to as the choose element.
After the form is submitted, the name property is required to refer to the form data (if you omit the name attribute, no data from the drop-down list will be submitted).
The id element is required to link the drop-down list to a label.
For optimum accessibility standards, always include the <label>
tag!
Syntax
Attributes
Attribute | Value | Description |
---|---|---|
autofocus | autofocus | When the page loads, the drop-down list should instantly acquire emphasis. |
disabled | disabled | Specifies whether or not a drop-down list should be enabled. |
form | form-id | Defines who the items in the drop-down list belong to. |
multiple | multiple | This specifies that many options can be picked at the same time. |
name | name | Give the drop-down list a name. |
required | required | Specifies that the user must choose a value before submitting the form. |
size | number | The number of visible options in a drop-down list is specified. |
Supported Browsers
Element | Chrome | Firefox | Safari | Edge / IE | Opera |
---|---|---|---|---|---|
<select> | Yes | Yes | Yes | Yes | Yes |