HTML DOM Option Object
Option Object
The Option object represents an option in a dropdown list in an HTML form.
For each instance of an <option> tag in an
HTML form, an Option object is created.
You can access an Option object by searching through the elements[] array
of the form, or by using document.getElementById().
IE: Internet Explorer, F: Firefox, O: Opera, W3C:
World Wide Web Consortium (Internet Standard).
Option Object Properties
| Property |
Description |
IE |
F |
O |
W3C |
| defaultSelected |
Returns the default value of the selected attribute |
4 |
1 |
9 |
Yes |
| disabled |
Sets or returns whether or not an
option should be disabled |
4 |
1 |
9 |
Yes |
| form |
Returns a reference to the form that contains an option |
4 |
1 |
9 |
Yes |
| id |
Sets or returns the id of an option |
4 |
1 |
9 |
Yes |
| index |
Returns the index position of an option in a dropdown list |
4 |
1 |
9 |
Yes |
| label |
Sets or returns a label for an option (only for
option-groups) |
6 |
|
|
Yes |
| selected |
Sets or returns the value of the selected attribute |
4 |
1 |
9 |
Yes |
| text |
Sets or returns the text value of an option |
4 |
1 |
9 |
Yes |
| value |
Sets or returns the value to be sent to the
server |
4 |
1 |
9 |
Yes |
Standard Properties
| Property |
Description |
IE |
F |
O |
W3C |
| className |
Sets or returns the class attribute of an element |
5 |
1 |
9 |
Yes |
| dir |
Sets or returns the direction of text |
5 |
1 |
9 |
Yes |
| lang |
Sets or returns the language code for an element |
5 |
1 |
9 |
Yes |
| title |
Sets or returns an element's advisory title |
5 |
1 |
9 |
Yes |
Learn XML with Stylus Studio XML Tools - Free Download!
 |
|
Stylus Studio makes it easy to edit and validate XML, XSLT, DTD, XML Schema, XHTML, XPath, XQuery and Web Service applications.
Free XML video demonstrations will help you learn XML and become a W3C XML development master in just minutes!
Download a FREE Trial Now!
|
|