Search w3schools.com:

SHARE THIS PAGE

DOM Node firstChild Property

Node Object Reference Node Object

Example

Return the first child node of the document:

document.firstChild;

Try it yourself »

Definition and Usage

The firstChild property returns the first child node of the specified node, as a Node object.

Read more about the Node object in our Node object reference.

Note: In HTML, the document itself is the parent node of the HTML element, HEAD and BODY are child nodes of the HTML element.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The firstChild property is supported in all major browsers.


Syntax

node.firstChild

Technical Details

Return Value: The first child of the node, as a Node object
DOM Version Core Level 1


Node Object Reference Node Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]