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
Related information
- How to create a web page.
- How to create a website with no coding experience.
- How to write a JavaScript.
- HTML and web design help.