Name

select — HTML 4.01 | HTML5

Synopsis

<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

Attributes

Core, Internationalization, Events; plus onfocus, onblur, onchange, HTML5 Global Attributes

autofocus (autofocus="autofocus" in XHTML)

HTML5 only. Indicates the control should have focus (be highlighted and ready for user input) when the document loads.

disabled (disabled="disabled" in XHTML)

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

form="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 (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="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="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 ...

Get HTML & XHTML Pocket Reference, 4th 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.