Forms & Controls
HTML <option> element
Represents a choice in select or a suggestion in datalist. value supplies the submitted value for a selected option in a select. Use a distinct machine value when the displayed label may change. selected sets the default state rather than permanently locking the selection. In datalist, options are suggestions instead of selected choices. It accepts global HTML attributes; individual global features may be inapplicable or restricted.
Formal Syntax & Structure
html syntaxhtml
<option value="a">Choice A</option>Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| disabled | boolean | Disables supported controls or elements. Disabled form controls are generally not focusable, validated or submitted. The exact effect depends on the element; disabled="false" still disables. |
| label | text | Supplies a human-readable label for optgroup, option or track. It is not the same as the label element used to name form controls. |
| selected | boolean | Sets an option's default selected state. The current selected property may change independently after interaction. A single-select should have only one default selected option. |
| value | string | Submitted value; if omitted, derives from option text. |
Return Value
HTMLOptionElement
Content model: Text in traditional select controls; customizable select has additional content rules.
Working Example
Example Snippethtml
<!doctype html><html lang="en"> <head> <meta charset="utf-8"> <title>HTML example</title> </head> <body> <label> Format <select name="format"> <option value="paper">Paperback</option> <option value="digital">Digital</option> </select> </label> </body></html>