option (HTML element)

Spec
Depr. Empty Version
No No HTML 2
Browser support (more…)
IE5.5+ FF1+ SA1.3+ OP9.2+ CH2+
Full Full Full Full Full

Syntax

<option selected="selected" value="value">
</option>

Description

Each option in a select element represents an option that the user can choose. The text contained between the opening <option> and closing </option> tags is displayed to the user, while the value attribute contains the actual data that will be sent when the form is submitted. The selected attribute is useful for preselecting a list option at page load.

Example

This code produces a simple select list in which the option elements are highlighted:

<form>
  <label for="favoritefood">Favorite food</label>
  <select name="favoritefood" id="favoritefood">
    <option>Cheese</option>
    <option>Egg</option>
    <option>Cabbage</option>
    ⋮
  </select>
</form>

Use This For …

The option element is used to create a single option in a select list. It would primarily be used for data capture purposes, but may also be used to create navigation. select lists are sometimes used for this purpose, with the destination presented as text content within the opening <option> and closing </option> tags, and the address, or URL, specified by the value attribute.

Compatibility

Internet Explorer Firefox Safari Opera Chrome
5.5 6.0 7.0 8.0 1.0 1.5 2.0 3.0 3.5 1.3 2.0 3.1 4.0 9.2 9.5 10.0 2.0
Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full

It causes no compatibility issues, and has excellent support across all tested browsers.

In this Section

User-contributed notes

Related Products