Html5 Option Tag

In the html5 <option> tag is used to identify option in the <select> list.you can use <option> tag inside of <datalist> or <select> tag. In the new features introduced in html5 that is <option> tag should use inside of <datalist> tag.

In the <option> tag can use with out any attribute but normally we will use value attribute for data value sent to server.

Disabled attribute is used to disable for option and label attribute is used to label for option and selected attribute is used to select for drop down list and value attribute is used to data sent for server.

Syntax:

<select>
  <option> ... </option>
</select>

Example Code

Car Name Lists
<select>
  <option value ="Achieva">Achieva</option>
  <option value ="Baja">Baja</option>
  <option value ="Caballero" selected>Caballero</option>
  <option value ="Cheyenne">Cheyenne</option>
</select>

Out Put:



Car Name Lists

In the above select box example <option> tag has been added to car name lists.





Content