HTML DOM childNodesProperty

元素对象参考手册Element Object

Example

Get the collection of child nodes of the body element:

document.body.childNodes;

Try it Yourself »

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 without any 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: A NodeList object, representing a collection of nodes.
DOM Version Core Level 1


元素对象参考手册Element Object

Other Extensions