HTML Option Tag
In HTML, the
<option> tag is used to define an item contained inside
<optgroup> or a
<option>tag is basically used to represent menu items in popups and lists of items in an HTML document.
The value attribute of the
<option>tag is a bit important because it is used to send value to the server.
<option>tag can also be used without using attributes.
<option> Tag Syntax and Usage
<option> tag requires both opening (start) tag and closing(end) tag.
The basic syntax for the same is given below:
<option> ...content here </option>
<option> Tag Attributes
<option> tag supports both global and event attributes and some of the common attributes are given below:
This attribute is used to indicate the text for the label which is used to define the meaning of option; If the label attribute is not defined than its value is that element text content.
This attribute is used to specify the value of an option that is to be sent to the server.
This attribute is used to specify that an option is disabled. It is a boolean attribute.
The value of this attribute is selected; this attribute is used to indicate that the option is preselected when the page gets loaded
<option> Tag Basic Example
Below we have a basic example of
Default CSS Settings for HTML
Browser Support for HTML
Following browsers support this attribute:
Google Chrome 6.0+
Internet Explorer 9.0+