HTML option element

Html <option> tag defines an option as a child of select or datalist elements.


<p>If you are given a chance to visit one of the following countries,then what will be your choice?</p>
  <option> Germany 
  <option> Canada 
  <option> New Zealand 
  <option> Australia
  <option> Egypt
Try </>

select element offers a list of different options. We select one option out of these options. Here, you can omit the end tag (</option>).

Related tags

<select> select tag represents a list of options.
<select> <option> ... </option> </select>

Tag omission

End tag of option element may be omitted.

Global Attributes

All the global attributes are applicable on the <option> element.

Specific Attributes

disabled disabled attribute disables the option element.
<select> <option disabled> ... </option> </select>
label label attribute defines label or caption of the option element.
<select> <option label="text"> ... </option> </select>
selected It is a boolean attribute. By default, That option is selected which contains the selected attribute.
<select> <option selected> ... </option> </select>
value value attribute represents the user visible content.
<select> <option value="text"> ... </option> </select>

Was this article helpful?




Get the newsletter