<select size="2">
<option value="Male">Male</option>
<option value="Female">Female</option>
</select>
<select>
<option value="Male">Male</option>
<option value="Female">Female</option>
</select>
<select>
<optgroup>
<option value="football">Football</option>
<option value="basketball">Basketball</option>
</optgroup>
<optgroup>
<option value="jets">Jets</option>
<option value="lakers">Lakers</option>
</optgroup>
</select>
The <select> element represents a form control which allows users to select options from a list.
If the multiple attribute is defined and set to multiple then users can select more than one item from the list.
| Content Category: | Flow Content Phrasing Content Interactive Content Listed Labelable Ssubmittable Resettable Form-Associated Element |
|---|---|
| Parent Elements: | Elements which nest Phrasing Content |
| Content Model: | <option> <optgroup> |
| Standardised: | HTML 2.0 |
| Status: | Valid |
| DTD | Updates |
|---|---|
| HTML 5 | Added new attributes, autofocus, form and required |
| XHTML 1.0 | No Changes |
| HTML 4.01 | No Changes |
| HTML 4.0 | No Changes |
| Browser | Version | Elements | Notes |
|---|---|---|---|
| Google Chrome | 0.2 | <select> | None |
| Mozilla Firefox | 1.0 | <select> | None |
| Opera | 3.5 | <select> | None |
| Apple Safari | 1.0 | <select> | None |
| Internet Explorer | 4.0 | <select> | None |
No Required Attributes
Optional Attributes are attributes which work with specific elements only. They can be used to modify and enhance the functionality of the element and even the page. Option Attributes are exactly that, optional.
| Attribute | Values | Description |
|---|---|---|
| autofoucs | ||
| disabled | ||
| form | ||
| multiple | ||
| name | ||
| required | ||
| size |
Global Attribtues are attributes which work on every HTML5 element, except the following: <base>, <head>, <html>, <meta>, <param>, <script>, <style>, and <title>.
| Attribute | Values | Description |
|---|---|---|
| accesskey | ||
| class | ||
| contenteditable | ||
| contextmenu | ||
| dir | ||
| draggable | ||
| dropzone | ||
| hidden | ||
| id | ||
| lang | ||
| spellcheck | ||
| style | ||
| tabindex | ||
| title |
Global Event Attributes are attributes which trigger an action, usually in javascript. For example, the onclick event attribute triggers a script to be run when the element is clicked on by the mouse.
Standard Attributes are attributes which work on every HTML 4 element, except the following: <base>, <head>, <html>, <meta>, <param>, <script>, <style>, and <title>.
| Attribute | Values | Description |
|---|---|---|
| accesskey | ||
| class | ||
| dir | ||
| ltr | ||
| id | ||
| lang | ||
| style | ||
| tabindex | ||
| title | ||
| xml:lang |
Standard Event Attributes are attributes which trigger an action, usually a javascript action. For example, the onclick event attribute triggers a script to be run when the element is clicked on by the mouse.
| Attribute | Description |
|---|---|
| onblur | |
| onclick | |
| ondblclick | |
| onfocus | |
| onmousedown | |
| onmousemove | |
| onmouseout | |
| onmouseover | |
| onmouseup | |
| onkeydown | |
| onkeypress | |
| onkeyup |
The following attributes are for use only in XHTML documents. They are used to precisely define the elements meta data.
| Attribute | Values | Description |
|---|---|---|
| xml:lang | ||
| xml:space | ||
| xmlns |