Latest web development tutorials

HTML DOM firstChild property

Elements Object Reference Element object

Examples

Returns the document node first node:

document.firstChild;

try it"

Definition and Usage

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

Note: If the selected node has no children, this property returns NULL.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support firstChild property


grammar

node .firstChild

technical details

return value: The first child of the node.
DOM version Core Level 1 Node Object


Elements Object Reference Element object