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.
var optionElementReference = new Option([text, [value, [defaultSelected, [selected]]]]);
value
attribute.selected
attribute, the default is false
. A value of true
does not set the option to selected. false
(not selected). If omitted, even if the defaultSelected
argument is true, the option is not selected.Specification | Status | Comment |
---|---|---|
HTML5 The definition of 'Option' in that specification. | Recommendation |
© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLOptionElement/Option