Skip to main content

NodeList

NodeList objects are collections of nodes, usually returned by properties such as Node.childNodes and methods such as document.querySelectorAll().

MDN Reference

Extended by​

Indexable​

[index: number]: Node

Methods​

[iterator]()​

iterator: ArrayIterator<Node>;

Returns​

ArrayIterator<Node>


entries()​

entries(): ArrayIterator<[number, Node]>;

Returns an array of key, value pairs for every entry in the list.

Returns​

ArrayIterator<[number, Node]>


forEach()​

forEach(callbackfn, thisArg?): void;

Parameters​

ParameterType
callbackfn(value, key, parent) => void
thisArg?any

Returns​

void


item()​

item(index): Node | null;

Returns a node from a NodeList by index. This method doesn't throw exceptions as long as you provide arguments. A value of null is returned if the index is out of range, and a TypeError is thrown if no argument is provided.

MDN Reference

Parameters​

ParameterType
indexnumber

Returns​

Node | null


keys()​

keys(): ArrayIterator<number>;

Returns an list of keys in the list.

Returns​

ArrayIterator<number>


values()​

values(): ArrayIterator<Node>;

Returns an list of values in the list.

Returns​

ArrayIterator<Node>

Properties​

length​

readonly length: number;

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

MDN Reference