NodeList

Updated: 12/31/2022 by Computer Hope

In the DOM (document object model) in browsers, NodeList is an object consisting of a list of all nodes in a page. A NodeList may also consist of all nodes in a particular selected set of nodes. A NodeList can be selected using a programming language, such as JavaScript. For example, a NodeList can be selected using the getElementsByTagName() method of the document object in JavaScript. The example below obtains a collection of all the div nodes in the document.

var div_nodes = document.getElementsByTagName("div");

If there are two div elements in the document, the NodeList (the value of the div_nodes variable here) contains two nodes. If there are three elements, the NodeList contains three elements, etc.

Programming terms