25.23. The Option Object

The Option object represents OPTION entries in a SELECT element. It is normally accessed through the options array of a Select object, which in turn is accessed through the elements array of a Form object.

Constructors

new Option()

new Option(text)

new Option(text, value)

new Option(text, value, defaultSelected)

new Option(text, value, defaultSelected, selected)

These constructors create a new Option object, which you can dynamically insert into a Select object by placing it on the end of the options array.

Properties

defaultSelected This Boolean property determines whether the Option is selected by default. It is specified through the SELECTED attribute and is read-only.

index This property gives the position of this Option ...

Get Core Web Programming, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.