FANDOM


The HTML <option></option> element is used to create a control representing an option of a <select>, <optgroup>, or <datalist> element. In other words, it defines an option in a selected list.


Attributes

  • disabled - If this Boolean attribute is set, this option is not checkable. Often browsers cancel out such control and it won't receive any browsing event, like mouse clicks or focus-related ones. If this attribute is not set, the element can still be disabled if one its ancestors is a disabled <optgroup> element.
  • label - This attribute is text for the label indicating the meaning of the option. If this attribute isn't defined, its value is that of the element text content.
  • selected - If present, this Boolean attribute indicates that the option is initially selected. If the <option> element is the descendant of a <select> element whose multiple attribute is not set, only one single <option> of this <select> element may have this attribute.
  • value - The textual content of this attribute represents the label explaining the option. If it is not defined, its default value is the text content of the element.


HTML example:

<select>
      <option>Red</option>
      <option>Blue</option>
</select>

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.