option element
<Option>
Explanation
Option element is used to create the options/choices in a drop down list box.
<select>
<option value="Text">Text</option>
</select>
Element Specific attributes supported by this element are:
Attribute | Value | Description |
disabled | disabled | A particular option will be disabled. |
label | text | Provides shorter label for an option. |
selected | selected | When the page gets loaded, it makes a particular option selected as default. |
value | text | Value should be sent to the server. |
Example Code:
Result :
What is the capital of Switzerland?
- It must be placed inside the <select>.
- In HTML 4.01, the <datalist> cannot include this element.
It is available in the previous versions of HTML.
It supports both
Global Attributes and
Event Attributes in HTML5.
Limitations:
It is applicable to all major browsers.