Nodelist

Updated: 04/26/2017 by Computer Hope

In the Document Object Model (DOM) in Web browsers, NodeList is an object that consists of a list of all of nodes in a document or of all of the nodes within 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 of 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) will contain two nodes. If there are three elements, the NodeList will contain three elements, etc.

Programming terms