HTMLSelectElement |
a <select> element in an HTML
form |
Availability
DOM Level 1 HTML
Inherits from/Overrides
Node Element HTMLElement HTMLSelectElement
Properties
- boolean disabled
-
If
true, the <select>
element is disabled and the user may not interact with it. Mirrors
the disabled attribute.
- readonly HTMLFormElement form
-
The
<form> element that contains this one.
- readonly long length
-
The number
of <option> elements contained by this
<select> element. Same as
options.length.
- boolean multiple
-
If
true, the <select>
element allows multiple options to be selected. Otherwise, the
selections are mutually exclusive and only one may be selected at a
time. Mirrors the multiple attribute.
- String name
-
The name of
this form element. Mirrors the name attribute.
- readonly HTMLCollection options
-
An array
(HTMLCollection) of HTMLOptionElement objects that represent the
<option> elements contained in this
<select> element, in the order in which they
appear.
- long selectedIndex
-
The
position of the selected option in the options
array. If no options are selected, this property is -1. If multiple
options are selected, this property returns the index of the first
selected option.
- long size
-
The number of
options to display at once. If this property is 1, the
<select> element will typically be displayed
using a drop-down menu or list. If it is greater than 1, the
<select> is typically displayed using a
fixed-size list control, with a scrollbar if necessary. Mirrors the
size attribute.
- long tabIndex
-
The
position of this element in the tabbing order. Mirrors the
tabindex attribute.
- readonly String type
-
If
multiple is true, this property
is "select-multiple". Otherwise, it is
"select-one".
Methods
- add( )
-
Inserts a new HTMLOptionElement into the options
array, either by appending it at the end of the array or by inserting
it before another specified option.
- blur( )
-
Takes keyboard focus away.
- focus( )
-
Transfers keyboard focus to this element.
- remove( )
-
Removes the <option> element at the
specified position.
Description
This interface represents a <select> element
in an HTML form. The options property provides
convenient access to the set of <option>
elements it contains, and the add( ) and
remove( ) methods provide an easy way to modify
the set of options.
See Also
HTMLFormElement, HTMLOptionElement; Option and Select objects in the
client-side reference section; Chapter 15
|