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 select element 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 form element to which it belongs.

  • multiple (multiple="multiple" in XHTML)

    Allows the user to select more than one option from the list. Without this attribute, only a single entry can be selected.

  • name="Text"

    Required. Defines a name for the select element. When the form is submitted, this name and the values of the selected option elements are passed to the processing application.

  • size="Zahl"

    Defines the number of rows displayed in the selection list. For values greater than 1 the options appear as a scrollable list, with the number of visible items equal to the value of size. With size="1" the list appears as a dropdown menu.

    If the attribute multiple is not used, the default is 1. When using multiple the 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>

 

> back to the alphabetical list of elements

   

 

 

 

back to top