Name
HTMLOptionElement — an <option> in an HTML form
Availability
DOM Level 1 HTML
Inherits from/Overrides
Node → Element → HTMLElement → HTMLOptionElement
Properties
-
boolean defaultSelected The initial value of the
selectedattribute of the<option>element. If the form is reset, theselectedproperty is reset to the value of this property. Setting this property also sets the value of theselectedproperty.-
boolean disabled If
true, this option is disabled and the user is not allowed to select it. Mirrors thedisabledattribute.-
readonlyHTMLFormElementform A reference to the
<form>element that contains this element.-
readonly long index The position of this
<option>element within the<select>element that contains it.-
String label The text to be displayed for the option. Mirrors the
labelattribute. If this property is not specified, the plain-text content of the<option>element is used instead.-
boolean selected The current state of this option: if
true, the option is selected. The initial value of this property comes from theselectedattribute.-
readonly String text The plain text contained within the
<option>element. This text appears as the label for the option.-
String value The value submitted with the form if this option is selected when form submission occurs. Mirrors the
valueattribute.
Description
This interface describes an <option> element
within a <select> element.
See Also
HTMLFormElement, HTMLInputElement, HTMLSelectElement; Option and Select objects ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access