You are here: Reference > HTML > tags > option

option element

Browser support:
Specifies an item in a selection list.
The option element is used to add items to a select element. If the select element that contains the option tag is placed within a submittable form, and the form is submitted, the contents of the value attribute of the selected option(s) will be sent to the server. If the value attribute is not specified, the text content of the option tag will be sent.
You can set the initial selected state with the SELECTED attribute.
For further details, see the page for the select tag.
If you want to see the HTML tags by categories, please visit this page.
This element does not require a closing tag.
JavaScript page for this element: option.

Possible members:

Attributes
Events
Styles
Pseudos
accessKey
Sets an access key to an element.
class
Sets the style class or classes that belong to the element.
contentEditable
3
Sets whether the contents of the object are editable.
dir
Sets the text direction as related to the lang attribute.
DISABLED
8
Sets the state of an object for user interaction.
id
Sets a unique identifier for the object.
label
Sets a short label for an option element.
lang
Specifies the language of the element.
language
Sets the scripting language for the current element. Use it only for the script element.
name
Sets the name of an element.
SELECTED
Specifies the initial state of an option element.
style
Sets an inline style associated with an element.
tabIndex
Specifies the tabbing order for keyboard navigation using the TAB key.
title
Specifies a tooltip for an element.
value
Specifies the value of an option element.
xml:lang
Sets the language code of the XML document.

Example HTML code 1:

This example illustrates the use of the option element:
<select>
    <option value="Apple">Apple</option>
    <option value="Pear">Pear</option>
    <option value="Peach">Peach</option>
</select>
Did you find this example helpful? yes no

Example HTML code 2:

This example illustrates a multiple list control:
<select size="3" multiple="multiple">
    <option value="Apple">Apple</option>
    <option value="Pear">Pear</option>
    <option value="Peach">Peach</option>
</select>
Did you find this example helpful? yes no

Related pages:

External links:

User Contributed Comments

Post Content

Post Content