Skip to main content

HTMLAllCollection

The HTMLAllCollection interface represents a collection of all of the document's elements, accessible by index (like an array) and by the element's id. It is returned by the document.all property.

MDN Reference

Indexable

[index: number]: Element

Methods

[iterator]()

iterator: ArrayIterator<Element>;

Returns

ArrayIterator<Element>


item()

item(nameOrIndex?): Element | HTMLCollection | null;

The item() method of the HTMLAllCollection interface returns the element located at the specified offset into the collection, or the element with the specified value for its id or name attribute.

MDN Reference

Parameters

ParameterType
nameOrIndex?string

Returns

Element | HTMLCollection | null


namedItem()

namedItem(name): Element | HTMLCollection | null;

The namedItem() method of the HTMLAllCollection interface returns the first Element in the collection whose id or name attribute matches the specified name, or null if no element matches.

MDN Reference

Parameters

ParameterType
namestring

Returns

Element | HTMLCollection | null

Properties

length

readonly length: number;

The HTMLAllCollection.length property returns the number of items in this HTMLAllCollection.

MDN Reference