Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM childNodes Property

HTML DOM childNodes Property

Element Object Reference Element object

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

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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 Reference Element object