Join us online - 19th of November
Save your spot
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 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.

MDN Reference

interface HTMLCollection {
    length: number;
    "[iterator]"(): ArrayIterator<Element>;
    item(index: number): Element | null;
    namedItem(name: string): Element | null;
    [index: number]: Element;
}

Hierarchy (View Summary)

Indexable

Index
length: number

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

MDN Reference

  • 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.

    MDN Reference

    Parameters

    • name: string

    Returns Element | null

Was this helpful?