Share on Google+Share on Google+

HTML5 option tag, Example of <option>tag.

In this section, you will see the use of <option>tag of HTML5.

HTML5 option tag, Example of <option> tag.

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:
Attribute provides significant information about the option tag for the browser. There are following attributes......

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.

Declaration Syntax :

Declaration syntax of <option> in HTML5.

                         <option attributes> Text </option >

Example of <option> in HTML5:

<!DOCTYPE html >
<html >
<title>Title of document</title>
<p><strong>option</strong><b> tag Example.</b></p>
<p><b>Implementation of &lt;option&gt; in HTML5.</b></p>
<select style="width: 139px">
<option disabled>PHP</option>

Download this code

Difference Between HTML5 and HTML4.01:

The <option> tag is available in both HTML5 and HTML4.01.


Posted on: September 13, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.


Advertisement null