HTML <option> tag
You are Here:
HTML <option> tag
The <option>
tag is used to define an item contained in the <select> tag, an <optgroup> tag, or a <datalist> tag.
Note: The value
attribute for <option> tag is optional.
Example
HTML Online Editor
<!DOCTYPE html>
<html>
<body>
<select>
<option>Apple</option>
<option>Banana</option>
<option>Cherry</option>
</select>
</body>
</html>
Attributes
The following are the attributes of <option> tag. Also try Global attributes.
Attribute | Value | Explanation |
---|---|---|
disabled | - | Specifies that an option should be disabled. |
label | text | Indicates the meaning of the option. If it is not defined, its value is that of the element text content. Inverse of value attribute. |
selected | - | Specifies the default value of the select list. |
value | text | Specifies the value to be sent to a server when a form is submitted. Inverse of label attribute. |
Reminder
Hi Developers, we almost covered 99.5% of HTML Tutorials with examples for quick and easy learning.
We are working to cover every Single Concept in HTML.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.