Option in a Select list.
Platform Support
| IE | Mozilla | Netscape | Opera | Chrome | Safari | 3.0+ | 1.0+ | 2.0+ | no | no | no |
|---|
Constructors
| Constructor | Action | IE | Mozilla | Netscape | Opera | Chrome | Safari | ||
|---|---|---|---|---|---|---|---|---|---|
|
Option Constructor() : Option
Creates a new instance of an Option object.
|
Show Details | 3.0+ | 1.0+ | 2.0+ | no | no | no | ||
Option() : OptionCreates a new instance of an Option object. Returns
|
|||||||||
Properties
| Property | Action | IE | Mozilla | Netscape | Opera | Chrome | Safari |
|---|---|---|---|---|---|---|---|
|
defaultSelected
: Boolean
Whether or not the option is selected by default.
|
Show Details | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 5.0+ | 1.0+ |
|
|||||||
|
index
: Number
Index in the options array for the option.
|
Show Details | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 5.0+ | 1.0+ |
|
|||||||
|
selected
: Boolean
Whether or not the option is currently selected.
|
Show Details | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 5.0+ | 1.0+ |
|
|||||||
|
text
: String
Text for the option.
|
Show Details | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 5.0+ | 1.0+ |
|
|||||||
|
value
: String
Value of the option that is sent when the form is submitted.
|
Show Details | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 5.0+ | 1.0+ |
|
|||||||
References
Select|Select.options[]|HTMLOptionElement|HTMLSelectElement
Availability
JavaScript 1.0|enhanced in JavaScript 1.1|W3C