HTML <option> Tag

Advertisements


Description

The HTML <option> tag is used within a form for defining options in the drop-down list.

Example

<!DOCTYPE html>
<html>
<head>
<title>HTML option Tag</title>
</head>
<body>
<form action="/cgi-bin/dropdown.cgi" method="post">
<select name="dropdown">
<option value="Java" selected>Maths</option>
<option value="Ruby">Physics</option>
</select>
<input type="submit" value="Submit" />
</form>
</body>
</html>

This will produce following result:

Global Attributes

This tag supports all the global attributes described in - HTML Attribute Reference

Specific Attributes

The HTML <option> tag also supports following additional attributes:

AttributeValueDescription
disabled disabledDisables the input control. The button won't accept changes from the user. It also cannot receive focus and will be skipped when tabbing.
label textDefines a label to use when using <optgroup>.
selected selectedDefines the default option to be selected when page loads.
valuetextSpecifies the value of the option to be sent to the server.

Event Attributes

This tag supports all the event attributes described in - HTML Events Reference

Browser Support

ChromeFirefoxIEOperaSafariAndroid
YesYesYesYesYesYes

html_tags_reference.htm