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

  1. The type attribute is the string "select-multiple" when the multiple attribute is true.
  2. The selectedIndex attribute contains the ordinal index of the selected option.
  3. If no element is selected, then the value of the selectedIndex attribute is equal to -1.
  4. The value attribute contains the current form control value.
  5. The length attribute contains the number of options in this SELECT.
  6. The form attribute returns the FORM element containing this control.
  7. The form attribute returns null if this control is not within the context of a form.
  8. The options attribute is the collection of OPTION elements contained by this element.
  9. The disabled attribute indicates that the control is unavailable in this context.
  10. If the multiple attribute is set to true then multiple OPTION elements may be selected in this SELECT form.
  11. The name attribute is the form control or object name when submitted via a form.
  12. If the size attribute contains the number of visible rows.
  13. The tabIndex attribute is an index that represents the element's position in the tabbing order.
  14. Methods

  15. The add(element,before) method adds a new element to the collection of OPTION elements for this SELECT.
  16. If the before parameter is null then the add(element,before) method adds the element to the tail of the list.
  17. The remove(index) method removes an element from the collection of OPTION elements for this SELECT.
  18. The remove(index) method does nothing if no element has the given index.
  19. The blur() method removes keyboard focus from this element.
  20. The focus() method gives keyboard focus to this element.

If you have comments or suggestions, email me at mbrady@nist.gov