---
title: "HTMLAllCollection | JavaScript maps SDK"
description: "Documentation for MapTiler SDK"
---

# Interface 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](https://developer.mozilla.org/docs/Web/API/HTMLAllCollection)

interface HTMLAllCollection {  
    [length](#length): number;  
    ["\[iterator\]"](#iterator-1)(): [ArrayIterator](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.ArrayIterator/)<[Element](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Element/)\>;  
    [item](#item-1)(nameOrIndex?: string): [Element](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Element/) | [HTMLCollection](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.HTMLCollection/) | null;  
    [namedItem](#nameditem-1)(name: string): [Element](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Element/) | [HTMLCollection](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.HTMLCollection/) | null;  
    \[index: number\]: [Element](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Element/);  
}

#### Indexable

-   \[index: number\]: [Element](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Element/)
    

##### Index

### Properties[](#properties)

[length](#length)

### Methods[](#methods)

[\[iterator\]](#iterator) [item](#item) [namedItem](#nameditem)

## Properties[](#properties-1)

### `Readonly`length[](#length)

length: number

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

[MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAllCollection/length)

## Methods[](#methods-1)

### \[iterator\][](#iterator)

-   "\[iterator\]"(): [ArrayIterator](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.ArrayIterator/)<[Element](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Element/)\>[](#iterator-1)
    
    #### Returns [ArrayIterator](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.ArrayIterator/)<[Element](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Element/)\>
    

### item[](#item)

-   item(nameOrIndex?: string): [Element](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Element/) | [HTMLCollection](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.HTMLCollection/) | null[](#item-1)
    
    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](https://developer.mozilla.org/docs/Web/API/HTMLAllCollection/item)
    
    #### Parameters
    
    -   `Optional`nameOrIndex: string
    
    #### Returns [Element](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Element/) | [HTMLCollection](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.HTMLCollection/) | null
    

### namedItem[](#nameditem)

-   namedItem(name: string): [Element](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Element/) | [HTMLCollection](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.HTMLCollection/) | null[](#nameditem-1)
    
    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](https://developer.mozilla.org/docs/Web/API/HTMLAllCollection/namedItem)
    
    #### Parameters
    
    -   name: string
    
    #### Returns [Element](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Element/) | [HTMLCollection](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.HTMLCollection/) | null
