XML technologies / HTML & XHTML / Alphabetical list of HTML and XHTML elements / select
(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
select
HTML 4.01 | HTML 5 |
<select> ... </select>
Defines a menu or scrollable list allowing multiple items to be selected. The select element acts as a container for one or more option or optgroup elements.
Start/end tag
Required/required
Attributes
Core, Internationalization, events; additionally: onfocus, onblur, onchange, global HTML 5 attributes
autofocus(autofocus="autofocus"in XHTML)HTML 5 only. Specifies that the element should receive focus when the document loads: it is highlighted and ready to accept input.
disabled(disabled="disabled"in XHTML)Specifies that the
selectelement is initially disabled. A script can enable it again.form="ID des übergeordneten Formulars"HTML 5 only. Creates an explicit association between the input element and its parent form. The input element therefore need not be a child of the
formelement to which it belongs.multiple(multiple="multiple"in XHTML)Allows the user to select more than one
optionfrom the list. Without this attribute, only a single entry can be selected.name="Text"Required. Defines a name for the
selectelement. When the form is submitted, this name and the values of the selectedoptionelements are passed to the processing application.size="Zahl"Defines the number of rows displayed in the selection list. For values greater than
1the options appear as a scrollable list, with the number of visible items equal to the value ofsize. Withsize="1"the list appears as a dropdown menu.If the attribute
multipleis not used, the default is1. When usingmultiplethe number of displayed entries depends on the browser; four entries are often shown.tabindex="Zahl"Specifies the position in the tab order. Pressing the Tab key repeatedly lets users move between form fields and activate them.
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