For AI agents: a documentation index is available at /llms.txt. Markdown versions of all pages
are available by appending .md to any URL.
Interface HTMLOptionsCollection
interface HTMLOptionsCollection {
length: number;
selectedIndex: number;
"[iterator]"(): ArrayIterator<HTMLOptionElement>;
add(
element: HTMLOptGroupElement | HTMLOptionElement,
before?: number | HTMLElement | null,
): void;
item(index: number): HTMLOptionElement | null;
namedItem(name: string): HTMLOptionElement | null;
remove(index: number): void;
[index: number]: HTMLOptionElement;
}
length: number;
selectedIndex: number;
"[iterator]"(): ArrayIterator<HTMLOptionElement>;
add(
element: HTMLOptGroupElement | HTMLOptionElement,
before?: number | HTMLElement | null,
): void;
item(index: number): HTMLOptionElement | null;
namedItem(name: string): HTMLOptionElement | null;
remove(index: number): void;
[index: number]: HTMLOptionElement;
}
Hierarchy (View Summary)
- HTMLCollectionOf<HTMLOptionElement>
- HTMLOptionsCollection
Indexable
Properties
length
length: number
The length property of the HTMLOptionsCollection interface returns the number of
selectedIndex
selectedIndex: number
The selectedIndex property of the HTMLOptionsCollection interface is the numeric index of the first selected
Methods
[iterator]
-
Returns ArrayIterator<HTMLOptionElement>
add
-
The
add()method of the HTMLOptionsCollection interface adds an HTMLOptionElement or HTMLOptGroupElement to this HTMLOptionsCollection.Parameters
- element: HTMLOptGroupElement | HTMLOptionElement
Optionalbefore: number | HTMLElement | null
Returns void
item
-
The HTMLCollection method
item()returns the element located at the specified offset into the collection.Parameters
- index: number
Returns HTMLOptionElement | null
namedItem
-
Parameters
- name: string
Returns HTMLOptionElement | null
remove
-
The
remove()method of the HTMLOptionsCollection interface removes theParameters
- index: number
Returns void
The
HTMLOptionsCollectioninterface represents a collection ofMDN Reference