From http://www.w3schools.com (Copyright Refsnes Data)
The option element defines an option in the drop-down list.
In HTML 5, the <option> element is also used in the new element <datalist>.
Note: The <option> tag can be used without any attributes, but you usually need the value attribute, which indicates what is sent to the server.
Note: Use this tag in conjunction with <select> or <datalist> elements, elsewhere it is meaningless.
| Source | Output |
|---|---|
| <select> <option value ="volvo">Volvo</option> <option value ="saab">Saab</option> <option value ="opel" selected="selected">Opel</option> <option value ="audi">Audi</option> </select> |
| Attribute | Value | Description | 4 | 5 |
|---|---|---|---|---|
| disabled | disabled | Specifies that the option should be disabled when it first loads | 4 | 5 |
| label | text | Defines a label to use when using <optgroup> | 4 | 5 |
| selected | selected | Specifies that the option should appear selected (will be displayed first in the list) | 4 | 5 |
| value | text | Defines the value of the option to be sent to the server | 4 | 5 |
| class, contenteditable, contextmenu, dir, draggable, id, irrelevant, lang, ref, registrationmark, tabindex, template, title |
For a full description, go to Standard Attributes in HTML 5.
| 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.
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)