W3Schools.com

HTML5 <option> Tag

Example

A drop-down list with four options:

<select>
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="opel">Opel</option>
  <option value="audi">Audi</option>
</select>

Try it yourself »

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The <option> tag is supported in all major browsers.


Definition and Usage

The <option> tag defines an option in a select list.

The <option> element goes inside a <select> or <datalist> element.


Differences Between HTML 4.01 and HTML5

In HTML5, the <option> element is also used in the new <datalist> element.


Tips and Notes

Note: The <option> tag can be used without any attributes, but you usually need the value attribute, which indicates what is sent to the server.

Note: Use this tag in conjunction with <select> or <datalist> elements, elsewhere it is meaningless. 


Attributes

Attribute Value Description
disabled disabled Specifies that an option should be disabled
label text Specifies a shorter label for an option
selected selected Specifies that an option should be pre-selected when the page loads
value text Specifies the value to be sent to a server

Global Attributes

The <option> tag also supports the Global Attributes in HTML5.


Event Attributes

The <option> tag also supports the Event Attributes in HTML5.


WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Best Hosting Coupons
UK Reseller Hosting
Cloud Hosting
Top Web Hosting
$7.95/mo SEO Hosting
Premium Website Design
WEB BUILDING
Download XML Editor
FREE Website BUILDER
Free Website Templates Free CSS Templates
Make Your Own Website
W3SCHOOLS EXAMS
Get Certified in:
HTML, CSS, JavaScript, XML, PHP, and ASP
W3SCHOOLS BOOKS
New Books:
HTML, CSS
JavaScript, and Ajax
STATISTICS
Browser Statistics
Browser OS
Browser Display
SHARE THIS PAGE