Sponsors

Sponsors

HTML Element - <select>

Toggle Display
select.html
<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>

Element Info

Toggle Display

Description

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 Model

<select>
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

Element Updates

DTDUpdates
HTML 5Added new attributes, autofocus, form and required
XHTML 1.0No Changes
HTML 4.01No Changes
HTML 4.0No Changes

Browser Support

Toggle Display
BrowserVersionElementsNotes
Google Chrome0.2<select>None
Mozilla Firefox1.0<select>None
Opera3.5<select>None
Apple Safari1.0<select>None
Internet Explorer4.0<select>None

Element Attributes

Toggle Display

Required Attributes

No Required Attributes

Optional 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.

AttributeValuesDescription
autofoucs
disabled
form
multiple
name
required
size

HTML5 Global Attributes

Toggle Display

Global Attribtues are attributes which work on every HTML5 element, except the following: <base>, <head>, <html>, <meta>, <param>, <script>, <style>, and <title>.

AttributeValuesDescription
accesskey
class
contenteditable
contextmenu
dir
draggable
dropzone
hidden
id
lang
spellcheck
style
tabindex
title

HTML5 Global Event Attributes

Toggle Display

HTML 4 Standard Attributes

Toggle Display

Standard Attributes are attributes which work on every HTML 4 element, except the following: <base>, <head>, <html>, <meta>, <param>, <script>, <style>, and <title>.

AttributeValuesDescription
accesskey
class
dir
ltr
id
lang
style
tabindex
title
xml:lang

HTML 4 Event Attributes

Toggle Display

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.

AttributeDescription
onblur
onclick
ondblclick
onfocus
onmousedown
onmousemove
onmouseout
onmouseover
onmouseup
onkeydown
onkeypress
onkeyup

XHTML Reserved Attributes

Toggle Display

The following attributes are for use only in XHTML documents. They are used to precisely define the elements meta data.

AttributeValuesDescription
xml:lang
xml:space
xmlns

Feedback

Toggle Display

X