Latest web development tutorials

HTML DOM childNodes property

Elements Object Reference Element object

Examples

Get the body element child nodes:

document.body.childNodes;

try it"

Definition and Usage

childNodes property returns contain child nodes of the selected node NodeList.

Tip: If the selected node has no children, this property returns NodeList containing no nodes. For cycle child node list, use nextSibling property, higher than the use of the parent object's childNodes list of efficiency.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support childNodes property


grammar

element .childNodes

technical details

return value: NodeList object that represents a collection of nodes.
DOM version Core Level 1


Elements Object Reference Element object