Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Constructor for creating an HTMLOptionElement. The Option constructor is from the very early days of DOM scripting and has non–standard syntax, but has ubiquitous support in browsers.

Syntax

var optionElementReference = new Option([text, [value, [defaultSelected, [selected]]]]);

Return value and parameters

optionElementReference
A reference to the newly created HTMLOptionElement.
text
A string that sets the content of the element, i.e. the displayed text.
value
A string that sets the value attribute.
defaultSelected
A boolean that sets the selected attribute, the default is false. A value of true does not set the option to selected. 
selected
A boolean that sets the option's selected state, the default is false (not selected). If omitted, even if the defaultSelected argument is true, the option is not selected.

Specification

Specification Status Comment
HTML5
The definition of 'Option' in that specification.
Recommendation  

Document Tags and Contributors

 Contributors to this page: Mems, Robg1, fscholz, teoli, kscarfone, Sheppy, Brettz9
 Last updated by: Mems,