Skip to main content

HTMLCollectionOf

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.

MDN Reference

Extends​

Extended by​

Type Parameters​

Type Parameter
T extends Element

Indexable​

[index: number]: T

Methods​

[iterator]()​

iterator: ArrayIterator<T>;

Returns​

ArrayIterator<T>

Inherited from​

HTMLCollectionBase.[iterator]


item()​

item(index): T | null;

The HTMLCollection method item() returns the element located at the specified offset into the collection.

MDN Reference

Parameters​

ParameterType
indexnumber

Returns​

T | null

Overrides​

HTMLCollectionBase.item


namedItem()​

namedItem(name): T | null;

Parameters​

ParameterType
namestring

Returns​

T | null

Properties​

length​

readonly length: number;

The HTMLCollection.length property returns the number of items in a HTMLCollection.

MDN Reference

Inherited from​

HTMLCollectionBase.length