<OPTION>NN all   IE all   HTML all
<OPTION>...</OPTION>End Tag: Optional
 

The OPTION element defines an item that appears in a SELECT element listing, whether the listing is in a pop-up menu or scrolling list. OPTION elements associated with a SELECT element must be nested within the start and end tags of the SELECT element.

SELECT elements supply name/value pairs when the element is submitted as part of a FORM element. Typically, the NAME attribute of the SELECT element and the VALUE attribute of the selected option are submitted as the name/value pair. Therefore, it is important to assign a meaningful value to the VALUE attribute of each OPTION element in a select list. You can use the VALUE attribute to disguise user-unfriendly (but server-friendly) values from the user, while presenting a user-friendly entry that appears in the select list. Content for the human-readable entry of a select list is entered after the OPTION element's start tag. The end tag is optional because the entry is delimited either by the next OPTION element start tag or the SELECT element's end tag. See also the OPTGROUP attribute for possible future grouping of OPTION elements into hierarchical menu groupings.

 
Example
<SELECT NAME="chapters">
    <OPTION VALUE="1">Chapter 1
    <OPTION VALUE="2">Chapter 2
    <OPTION VALUE="3">Chapter 3
    <OPTION VALUE="4">Chapter 4
</SELECT>
 
Object Model Reference
NN [window.]document.formName.selectName.optionName
[window.]document.forms[i].elements[i].optionName
IE [window.]document.formName.selectName.optionName
[window.]document.forms[i].elements[i].optionName
[window.]document.all.elementID
DISABLEDNN n/a   IE n/a   HTML 4
DISABLEDOptional
 

The presence of this attribute disables the OPTION element in the list.

 
Example
<OPTION VALUE="Met101" DISABLED>Meteorology 101
 
Value
The presence of this attribute sets its value to true.
 
Default false
LABELNN n/a   IE n/a   HTML 4
LABEL="labelText"Required
 

The LABEL attribute is included in HTML 4.0 in anticipation of possible hierarchical select lists. The LABEL is intended to be a shorter alternate entry for an OPTION element when it is rendered hierarchically. It overrides the normal text associated with the OPTION element.

 
Example
<OPTION LABEL="Meteo 101" VALUE="met101"> Meteorology 101
 
Value
Any string of characters. The string must be inside a matching pair of (single or double) quotation marks.
 
Default None.
SELECTEDNN all   IE all   HTML all
SELECTEDOptional
 

The presence of the SELECTED attribute preselects the item within the SELECT element. When the SELECT element is set to MULTIPLE, more than one OPTION element may have the SELECTED attribute set.

 
Example
<OPTION VALUE="met101" SELECTED> Meteorology 101
 
Value
The presence of this attribute sets its value to true.
 
Default false
 
Object Model Reference
NN [window.]document.formName.selectName.optionName.selected
[window.]document.forms[i].elements[i].selected
IE [window.]document.formName.selectName.optionName.selected
[window.]document.forms[i].elements[i].selected
VALUENN all   IE all   HTML all
VALUE="text"Optional
 

Associates a value with an OPTION that may or may not be the same as the text displayed in the SELECT element. When the SELECT element is in a form submitted to the server, the value of the VALUE attribute is assigned to the name/value pair for the SELECT element if the option has been selected by the user (or is designated as SELECTED with that attribute and the user has made no other selection). For scripting purposes, the VALUE attribute might contain values such as URLs or string representations of objects that may subsequently be processed by scripts.

 
Example
<OPTION VALUE="met101"> Meteorology 101
 
Value
Any string of characters. The string must be inside a matching pair of (single or double) quotation marks.
 
Default None.
 
Object Model Reference
NN [window.]document.formName.selectName.optionName.value
[window.]document.forms[i].elements[i].value
IE [window.]document.formName.selectName.optionName.value
[window.]document.forms[i].elements[i].value
Hosted by uCoz