The option element defines an option in the drop-down list.
Differences Between HTML 4.01 and HTML 5
In HTML 5, the <option> element is also used in the new element <datalist>.
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.
Example
Source
Output
<select>
<option value ="volvo">Volvo</option>
<option value ="saab">Saab</option>
<option value ="opel" selected="selected">Opel</option>
<option value ="audi">Audi</option>
</select>
Attributes
4: indicates if the attribute is defined in HTML 4.01
5: indicates if the attribute is defined in HTML 5
Attribute
Value
Description
4
5
disabled
disabled
Specifies that the option should be disabled when it first
loads
4
5
label
text
Defines a label to use when using <optgroup>
4
5
selected
selected
Specifies that the option should appear selected (will be
displayed first in the list)
4
5
value
text
Defines the value of the option to be sent to the
server
Simple drop down box
How to create a simple drop-down box on an HTML page. A drop-down box is a
selectable list.
Another drop down box
How to create a simple drop-down box with a pre-selected value.
Want To Be A Web Master?
If you want to be a Web Master, you will have to host your web site with an ISP (Internet Service Provider).
MaximumASP offers seven different configurations of dedicated servers to meet your Windows and .NET hosting needs.
Hosted on our multi-tiered Enterprise Class network, these servers provide the performance, security and reliability
you need to host your high end web sites and applications.
W3Schools provides material for training only. We do not warrant the correctness of its contents.
The risk from using it lies entirely with the user.
While using this site, you agree to have read and accepted our
terms of use and
privacy policy.