<option> tag in HTML
The <option> tag is used to defines an options in a select list. The <option> element use inside a <select> OR <datalist> element in HTML documents.
Important Description
- Open and close tag required of <option>.
- Basically, the 'value' attribute need in <option> element, but you can use <option> element without any attribute.
- The 'value' attribute indicates what is sent to the server.
Example of <option> tag
Result Look Like
<option> Tag Browser Support
Element |
Chrome |
Edge |
Firefox |
Safari |
Opera |
<option> |
Yes |
Yes |
Yes |
Yes |
Yes |
Global Attributes
Event Attributes
Attributes
Attribute |
Value |
Description |
disabled |
disabled |
Defines that an option should be disabled |
label |
text |
Defines a label for the option |
selected |
selected |
Defines that an option should be pre-selected when the page loads |
value |
text |
Defines the value to be sent to a server |