Name
Select: a graphical selection list — DOM Level 2 HTML: Node → Element → HTMLElement → Select
Properties
-
readonly Form form The
<form>element that contains this<select>element.-
readonly long length The number of
<option>elements contained by this<select>element. Same asoptions.length.-
readonly HTMLCollection options An array (HTMLCollection) of Option objects that represent the
<option>elements contained in this<select>element, in the order in which they appear. SeeSelect.options[]for further details.-
long selectedIndex The position of the selected option in the
optionsarray. If no options are selected, this property is −1. If multiple options are selected, this property holds the index of the first selected option.Setting the value of this property selects the specified option and deselects all other options, even if the Select object has the
multipleattribute specified. When you’re doing listbox selection (whensize> 1), you can deselect all options by settingselectedIndexto −1. Note that changing the selection in this way does not trigger theonchange( )event handler.-
readonly String type If
multipleistrue, this property is “select-multiple”; otherwise, it is “select-one”. This property exists for compatibilty with thetypeproperty of the Input object.
In addition to the properties above, Select objects also mirror HTML attributes with the following properties:
|
Property |
Attribute |
Description |
|
|
|
Whether the user element ... |
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