HTML <option> tagHTML <option> tag is used to define options in a dropdown list within <select> or <datalist> element. A dropdown list must have at least one <option> element. The related <option> of a dropdown list can be grouped using <optgroup> element which helps to understand a large list. Tips: The <option> tag can be used without any attribute, but it should be used with value attribute which specifies what send to the server.
|
Display | Inline |
Start tag/End tag | Both Start and End tag |
Usage | Forms and Inputs |
Output:
Attribute | Value | Description |
---|---|---|
disabled | disabled | If it is set then that option will be disabled. |
label | text | It defines the name for the list item. |
selected | selected | If it is set, then it will be selected by default in the list. |
value | text | It specifies the data which is sent to the server. |
HTML <option> tag supports the global attributes in HTML
HTML <option> tag supports the event attributes in HTML.
Element | ![]() | ![]() | ![]() | ![]() | ![]() |
<option> | Yes | Yes | Yes | Yes | Yes |