HTML DOM Option Object

« Previous Chapter Next Reference »

Option Object

The Option object represents an option in a dropdown list in an HTML form.

For each <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().

Option Object Properties

W3C: W3C Standard.

Property Description W3C
defaultSelected Returns the default value of the selected attribute Yes
disabled Sets or returns whether or not an option should be disabled Yes
form Returns a reference to the form that contains an option Yes
index Returns the index position of an option in a dropdown list Yes
label Sets or returns a label for an option (only for option-groups) Yes
selected Sets or returns the value of the selected attribute Yes
text Sets or returns the text value of an option Yes
value Sets or returns the value to be sent to the server Yes

Standard Properties, Methods, and Events

The Option object also supports the standard properties, methods, and events.


« Previous Chapter Next Reference »

Have Any Suggestion? We Are Waiting To Hear from YOU!

Your Query was successfully sent!