Welcome to HTML5-Tutorials

Our site offers a lot of HTML5 learning from absolutely beginning to advanced level.If you want to make a website with HTML,this site will completely guide you a lot.So learn HTML5 syntax and form of coding easily with this website.If you have any doubt,leave a message on us.We will return you so soon.This site includes innumerable number of references you need to do after studying their corresponding elements.

In this page,we will learn about HTML <option> tag.

Use of <option> tag

The <option> tag is used to make option value in a drop down list within <select> element.

Display:Inline

Example of <option> tag

    <select>
          <option value="jack"> Jack </option>
          <option value="johnson"> Johnson </option>
    </select>

Supported Browsers.

Tag
<option> Yes Yes Yes Yes Yes

Full Code Example

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h4> Select a name </h4>
<select>
<option value="chaoba"> Chaoba </option>
<option value="tomba"> Tomba </option>
<option value="jackson"> Jackson </option>
<option value="mahesh"> Mahesh </option>
<option value="tom"> Tom </option>
<option value="ling"> Ling </option>
</select>
</body>
</html>

Output

Select a name

More Reference

You know that <option> element is used to make option value in a drop-down lists.But if many option value are there, it would be harder what we prefer to choose and hence use <optgroup> element to group the related options.
Generally,<option> elements is contained either <select> or <datalist> element.
Mainly, the <option> element is associated with the value attribute but it is not mandatory.

Attributes of <option> tag


Attribute Value Notes
disabled disabled It makes the <option> value disabled i.e makes usuable or unclickable value.
label text It defines a label for an <option> element.
selected selected It defines a default selected option or list from the many drop-down lists.
value text It defines the value send to the server when a item or list is selected.