From http://www.w3schools.com (Copyright Refsnes Data)

HTML 5 <select> tag


Definition and Usage

The select element creates a drop-down list.


Differences Between HTML 4.01 and HTML 5

HTML 5 has some new attributes, and some HTML 4.01 attributes are no longer supported.


Tips and Notes

Tip: Use this tag in the form element to accept user input.


Example

Source Output
<select>
  <option value ="volvo">Volvo</option>
  <option value ="saab">Saab</option>
  <option value ="opel">Opel</option>
  <option value ="audi">Audi</option>
</select>


Attributes

Attribute Value Description 4 5
autofocus true
false
Makes the select field focused on page load   5
data url For inserting data automatically   5
disabled true
false
When true, it disables the drop-down list 4 5
form true
false
Defines one ore more forms the select field belongs to.   5
multiple true
false
When true, it specifies that multiple items can be selected at a time 4 5
name unique_name Defines a unique name for the drop-down list 4 5
size number Defines the number of visible items in the drop-down list. Not supported. 4  

Standard Attributes

class, contenteditable, contextmenu, dir, draggable, id, irrelevant, lang, ref, registrationmark, tabindex, template, title

For a full description, go to Standard Attributes in HTML 5.

Event Attributes

onabort, onbeforeunload, onblur, onchange, onclick, oncontextmenu, ondblclick, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onerror, onfocus, onkeydown, onkeypress, onkeyup, onload, onmessage, onmousedown, onmousemove, onmouseover, onmouseout, onmouseup, onmousewheel, onresize, onscroll, onselect, onsubmit, onunload

For a full description, go to Event Attributes in HTML 5.


Try-It-Yourself Demos

Simple drop down box
How to create a simple drop-down box on an HTML page. A drop-down box is a selectable list.

Another drop down box
How to create a simple drop-down box with a pre-selected value.


From http://www.w3schools.com (Copyright Refsnes Data)