Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Option Object

HTML DOM Option Object


Option Object

The Option object represents an option in a drop-down list in an HTML form.

In an HTML form,

You can access an Option object 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 the option should be disabled. Yes
form Returns a reference to the form containing the option Yes
index Returns a reference to the containing
element.
Yes
selected Sets or returns the value of the selected attribute. Yes
text Sets or returns the plain text value of an option. Yes
value Sets or returns the value sent to the server. Yes

Standard properties and events

The Option object also supports the standard property and Events.