select

FilterElements

<select> ... </select>

Defines a multiple-choice menu or a scrolling list. It is a container for one or more option or optgroup elements.

Start/End Tags

Required/Required

Specifications

  • HTML 4.01
  • HTML5

autofocus

Values: None in HTML. (autofocus="autofocus" in XHTML5)
HTML5 only. Indicates the control should have focus (be highlighted and ready for user input) when the document loads.

disabled

Values: None in HTML. (disabled="disabled" in XHTML)
Indicates that the select element is initially nonfunctional. It can be reactivated with a script.

form=

Values: id of the form owner
HTML5 only. Explicitly associates the input control with its associated form (its form owner). With this method, the input control does not need to be a child of the form element that applies to it.

multiple

Values: None in HTML. (multiple="multiple" in XHTML)
Allows the user to select more than one option from the list. When this attribute is absent, only single selections are allowed.

name=

Values: text
Required. Defines the name for the select control. When the form is submitted to the form-processing application, this name is sent along with each selected option value.

size=

Values: number
Specifies the number of rows that display in the list of options. For values higher than 1, the options are displayed as a scrolling list with the specified number of options visible. When size="1" is specified, the list is displayed as a pop-up menu.
The default value is 1 when multiple is not used. When multiple is specified, the value varies by browser (but a value of 4 is common).

tabindex=

Values: number
Specifies position in the tabbing order. Tabbing navigation allows the user to cycle through the active fields by using the Tab key.
<p>What are your favorite ice cream flavors?</p>
<select name="ice_cream" multiple="multiple">
  <option>Vanilla</option>
  <option>Chocolate</option>
  <option>Mint Chocolate Chip</option>
  <option>Pistachio</option>
</select>

Rendered Example

What are your favorite ice cream flavors?