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

# Interface HTMLCollectionOf<T>

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

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

#### Type Parameters

-   T extends [Element](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Element/)

#### Hierarchy ([View Summary](https://docs.maptiler.com/sdk-js/api-reference/hierarchy/#Externals.HTMLCollectionOf))

-   [HTMLCollectionBase](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.HTMLCollectionBase/)
    -   HTMLCollectionOf
        -   [HTMLOptionsCollection](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.HTMLOptionsCollection/)

#### Indexable

-   \[index: number\]: [T](#t)
    

##### Index

### Properties[](#properties)

[length](#length)

### Methods[](#methods)

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

## Properties[](#properties-1)

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

length: number

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

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

Inherited from [HTMLCollectionBase](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.HTMLCollectionBase/).[length](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.HTMLCollectionBase/#length)

## Methods[](#methods-1)

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

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

### item[](#item)

-   item(index: number): [T](#t) | null[](#item-1)
    
    The HTMLCollection method **`item()`** returns the element located at the specified offset into the collection.
    
    [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLCollection/item)
    
    #### Parameters
    
    -   index: number
    
    #### Returns [T](#t) | null
    
    Overrides [HTMLCollectionBase](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.HTMLCollectionBase/).[item](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.HTMLCollectionBase/#item)
    

### namedItem[](#nameditem)

-   namedItem(name: string): [T](#t) | null[](#nameditem-1)
    
    #### Parameters
    
    -   name: string
    
    #### Returns [T](#t) | null
