HTMLOptionsCollection is an interface representing a collection of HTML option elements (in document order) and offers methods and properties for traversing the list as well as optionally altering its items. This type is returned solely by the "options" property of select.

Documentation HTMLOptionsCollection by Mozilla Contributors, licensed under CC-BY-SA 2.5.

See:

Variables

Methods

add (element:EitherType<OptionElement, OptGroupElement>, ?before:EitherType<Element, Int>):Void

Throws:

null

DOMError

remove (index:Int):Void

Throws:

null

DOMError

Inherited Variables

Defined by HTMLCollection

read onlylength:Int

Returns the number of items in the collection.

Inherited Methods

Defined by HTMLCollection

item (index:Int):Element

Returns the specific node at the given zero-based index into the list. Returns null if the index is out of range.

namedItem (name:String):Element

Returns the specific node whose ID or, as a fallback, name matches the string specified by name. Matching by name is only done as a last resort, only in HTML, and only if the referenced element supports the name attribute. Returns null if no node exists by the given name.