Name
Select — a graphical selection list
Availability
JavaScript 1.0; enhanced in JavaScript 1.1
Inherits from/Overrides
Inherits from Input, HTMLElement
Synopsis
form.element_nameform.elements[i]
Properties
Select inherits properties from Input and HTMLElement and defines or overrides the following:
-
length A read-only integer that specifies the number of elements in the
options[]array. The value of this property is the same asoptions.length.-
options An array of Option objects, each of which describes one of the options displayed within the Select element. See the Select.options[] reference page for details about this array, including techniques for modifying the options displayed by the Select object.
-
selectedIndex An integer that specifies the index of the selected option within the Select object. If no option is selected,
selectedIndexis -1. If more than one option is selected,selectedIndexspecifies the index of the first one only.
In JavaScript 1.0, selectedIndex is a read-only
property. In JavaScript 1.1, it is read/write. Setting the value of
this property selects the specified option and deselects all other
options, even if the Select object has the
multiple attribute specified. When you’re
doing list-box selection (instead of drop-down menu selection), you
can deselect all options by setting selectedIndex
to -1. Note that changing the selection in this way does not trigger
the onchange( ) event handler.
-
type[ JavaScript 1.1] A read-only string property shared ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access