web api interface
HTMLOptionsCollection
The HTMLOptionsCollection interface represents a collection of <option> HTML elements (in document order) and offers methods and properties for selecting from the list as well as optionally altering its items. This object is returned only by the options property of select.
Instance properties
length- : Returns or sets the number of options in the collection.
selectedIndex- : The index number of the first selected
<option>element. The value-1indicates no element is selected.
- : The index number of the first selected
Instance methods
This interface inherits the methods of its parent, HTMLCollection.
add()- : Appends an
HTMLOptionElementorHTMLOptGroupElementelement to the collection ofoptionelements or adds it before a specified option.
- : Appends an
remove()- : Removes the element at the specified index from the options collection.
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.