XML technologies / HTML & XHTML / Alphabetical list of HTML and XHTML elements / option
(Excerpt from "HTML & XHTML ─ kurz & gut" by Jennifer Niederst Robbins)
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z
option
HTML 4.01 | HTML 5 |
<option> ... </option>
Defines an option within a select element, a list of choices displayed as a dropdown menu or scrollable list. The content of the option element is the value passed to the form processing program, unless the attribute value defines a different value.
Notes
In HTML 5, option can also be used within the datalist element.
Start/end tag
HTML: required/optional; XHTML: required/required
Attributes
Core, internationalization, events, global HTML 5 attributes
disabled(disabled="disabled"in XHTML)Specifies that the option is initially disabled. A script can enable it again.
label="Text"Allows the author to define a short label for the option’s content. This attribute is not supported.
selected(selected="selected"in XHTML)Marks this entry as already selected when the form loads.
value="Text"Using
valuecan define a value to use instead of the actual content of theoptionelement.
Example
<p>Was sind Ihre Lieblings-Eiscremesorten?</p>
<select name="eis" size="4" multiple="multiple">
<option>Vanille</option>
<option>Schokolade</option>
<option>Kokos-Curry</option>
<option>Lavendel</option>
<option>Blauschimmelkäse</option>
</select>
|
Copyright © 2010 O’Reilly Verlag GmbH & Co. KG
You may print the online version for your private use.
Otherwise, this chapter from "HTML & XHTML ─ kurz & gut" is subject to the same provisions as the printed edition: the work, including all its parts, is protected by copyright. All rights are reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
O’Reilly Verlag GmbH & Co. KG, Balthasarstraße 81, 50670 Köln, kommentar(at)oreilly.de