In this section, you will see the use of <option>tag of HTML5.
In this section, you will see the use of <option>tag of HTML5.Here, you will see the use of <option> tag in HTML5. The <option> tag is used for providing option for drop-down list or selection list. Every thing presents in option tag will be display in drop down list. It is like a child of select tag , datalist, and optgroup tag. The <option> tag can be used without any attributes.
Attribute of option:Attributes | Value | Description |
disabled | disabled or empty | Element does not receive focus of user. |
selected | selected or empty | option automatically selected. |
label | string | Define label for option. |
value | string | Initial value of option. |
<option attributes> Text </option > |
<!DOCTYPE html > <html > <head> <title>Title of document</title> </head> <body> <p><strong>option</strong><b> tag Example.</b></p> <p><b>Implementation of <option> in HTML5.</b></p> <select style="width: 139px"> <option></option> <option>C</option> <option>C++</option> <option>JAVA</option> <option disabled>PHP</option> </select> </body> </html> |
The <option> tag is available in both HTML5 and HTML4.01.