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

HTML DOM firstChild Property

HTML DOM firstChild Property

Element Object Reference Element object

Example

Return the first node of the document:

document.firstChild;

Try it »


Definition and Usage

The firstChild property returns the first child node of the selected node.

**Note:** If the selected node has no child nodes, this property returns NULL.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the firstChild property


Syntax

node

.firstChild

Technical Details

Return Value: The first child node of a node.
DOM version Core Level 1 Node Object

Element Object Reference Element object