Description

The <select> element defines a selection list within a <form>. The selection list typically displayed in the browser as a pull-down menu (i.e. a drop-down list) from which a user can select one or more options depending on its attributes. Each option offered by the selection list is defined by an <option> element.

The following table summarizes the usages context and the version history of this tag.

Placement:Inline
Content:One or more of `` and/or `
Start/ End Tag:Start tag: required, End tag: required
Version:HTML 2, 3.2, 4, 4.01, 5

Note: A <select> element must contain at least one <option> element. Options can be pre-selected for the user if attribute selected="selected" is specified to the start tag of the <option> element.

## Syntax

The basic syntax of the <select> tag is given with:

HTML/XHTML: <select> ... </select>

The example below shows the <select> tag in action.

<select>
    <option value="ferrari">Ferrari</option>
    <option value="mercedes">Mercedes</option>
   <option value="porsche">Porsche</option>
</select>        

Tip: You can use the <optgroup> tag for grouping related selects within a dropdown list. It will make your forms more accessible for the users, particularly when the user have to choose from a long list of selects.

Tag-Specific Attributes

The following table shows the attributes that are specific to the <select> tag.

Global Attributes

Like all other HTML tags, the <select> tag supports the global attributes in HTML5.

Event Attributes

The <select> tag also supports the event attributes in HTML5.

Browser Compatibility

Element
<select>YesYesYesYesYes