Module option

Module option 

Source
Expand description

Attribute names for option (<option>) elements.

§Purpose

The <option> element defines an option in a <select>, <optgroup>, or <datalist> element, representing a choice available to the user.

§Common Attributes

  • value: Value submitted when option is selected
  • selected: Pre-selects the option
  • disabled: Disables the option
  • label: Text label (defaults to element content)

§Example

<select name="size">
  <option value="">Choose size</option>
  <option value="s">Small</option>
  <option value="m" selected>Medium</option>
  <option value="l">Large</option>
  <option value="xl" disabled>Extra Large (Out of stock)</option>
</select>

§WHATWG Specification

Constants§

DISABLED
The disabled attribute.
LABEL
The label attribute.
SELECTED
The selected attribute.
VALUE
The value attribute.