HTML DOM childNodes Property
Example
Get the collection of child nodes of the body element:
document.body.childNodes;
Try it »
Definition and Usage
The childNodes property returns a NodeList containing the child nodes of the selected node.
**Tip:** If the selected node has no child nodes, this property returns a NodeList containing no nodes. To loop through the child node list, using the nextSibling property is more efficient than using the parent object's childNodes list.
Browser support





All major browsers support the childNodes property
Syntax
element
.childNodes
Technical Details
| Return Value: | NodeList object, representing a collection of nodes. |
|---|---|
| DOM version | Core Level 1 |
Element object