Name

select — <select> . . . </select>

Defines a multiple-choice menu or a scrolling list. It is a container for one or more option elements. This element may also contain one or more optgroup elements.

Attributes

Core, Internationalization, Events ; plus onfocus, onblur, onchange

disabled="disabled"

Indicates that the select element is initially nonfunctional. It can be reactivated with a script.

multiple="multiple"

Allows the user to select more than one option from the list. When this attribute is absent, only single selections are allowed.

name="text"

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

size="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="number"

Specifies position in the tabbing order. Tabbing navigation allows the user to cycle through the active fields by using the Tab key.

Example

<p>What are your favorite ice cream flavors?</p>
<select name="ice_cream">
   <option>Vanilla</option>
   <option>Chocolate</option>
   <option>Mint Chocolate Chip</option>
   <option>Pistachio</option>
</select>

Get HTML and XHTML Pocket Reference, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.