The option element defines an option in the drop-down list.
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.
Tip: Use this tag in the form element (to accept user input),
elsewhere it is meaningless.
Example
XHTML
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>
Optional Attributes
DTD indicates in which XHTML 1.0 DTD the attribute is
allowed. S=Strict, T=Transitional, and F=Frameset.
Attribute
Value
Description
DTD
disabled
disabled
Specifies that the option should be disabled when it first
loads
STF
label
text
Defines a label to use when using <optgroup>
STF
selected
selected
Specifies that the option should appear selected (will be
displayed first in the list)
STF
value
text
Defines the the value of the option to be sent to the
server
W3Schools is for training only. We do not warrant its correctness or its fitness for use.
The risk of using it remains entirely with the user. While using this site, you agree to have read and accepted our
terms of use and
privacy policy.