HTMLSelectElement Interface
The select element allows the selection of an option. The contained options can be directly accessed through the select element as a collection.
IDL Definition
Interface HTMLSelectElement : HTMLElement {
readonly attribute DOMString type;
attribute long selectedIndex;
attribute DOMString value;
readonly attribute long length;
readonly attribute HTMLFormElement form;
readonly attribute HTMLCollection options;
attribute boolean disabled
attribute boolean multiple;
attribute DOMString name;
attribute boolean size;
attribute boolean tabIndex;
void add(in HTMLElement element,
in HTMLElement before);
void remove(in long index);
void blur();
void focus();
};
Semantic Requirements
- The type attribute is the string "select-multiple" when the multiple attribute is true.
- The selectedIndex attribute contains the ordinal index of the selected option.
- If no element is selected, then the value of the selectedIndex attribute is equal to -1.
- The value attribute contains the current form control value.
- The length attribute contains the number of options in this SELECT.
- The form attribute returns the FORM element containing this control.
- The form attribute returns null if this control is not within the context of a form.
- The options attribute is the collection of OPTION elements contained by this element.
- The disabled attribute indicates that the control is unavailable in this context.
- If the multiple attribute is set to true then multiple OPTION elements may be selected in this SELECT form.
- The name attribute is the form control or object name when submitted via a form.
- If the size attribute contains the number of visible rows.
- The tabIndex attribute is an index that represents the element's position in the tabbing order.
Methods
- The add(element,before) method adds a new element to the collection of OPTION elements for this SELECT.
- If the before parameter is null then the add(element,before) method adds the element to the tail of the list.
- The remove(index) method removes an element from the collection of OPTION elements for this SELECT.
- The remove(index) method does nothing if no element has the given index.
- The blur() method removes keyboard focus from this element.
- The focus() method gives keyboard focus to this element.
If you have comments or suggestions, email me at mbrady@nist.gov