HTMLCollection
The HTMLCollection interface represents a generic collection (array-like object similar to arguments) of elements (in document order) and offers methods and properties for selecting from the list.
Extends
Indexable
[index: number]: Element
Methods
[iterator]()
iterator: ArrayIterator<Element>;
Returns
Inherited from
item()
item(index): Element | null;
The HTMLCollection method item() returns the element located at the specified offset into the collection.
Parameters
| Parameter | Type |
|---|---|
index | number |
Returns
Element | null
Inherited from
namedItem()
namedItem(name): Element | null;
The namedItem() method of the HTMLCollection interface returns the first Element in the collection whose id or name attribute match the specified name, or null if no element matches.
Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
Element | null
Properties
length
readonly length: number;
The HTMLCollection.length property returns the number of items in a HTMLCollection.