HTML DOM documentElement Property
THE WORLD'S LARGEST WEB DEVELOPER SITE

HTML DOM documentElement Property

❮ Document Object

Example

Return the documentElement of the document, as a node name:

var x = document.documentElement.nodeName;
Try it Yourself »

Definition and Usage

The documentElement property returns the documentElement of the document, as an Element object.

For HTML documents the returned object is the <html> element.

Note: This property is read-only.

Tip: The difference between this property and the document.body property, is that the document.body element returns the <body> element, while the document.documentElement returns the <html> element.


Browser Support

Property
documentElement Yes Yes Yes Yes Yes

Syntax

document.documentElement

Technical Details

Return Value: The document's documentElement, as an Element object
DOM Version Core Level 1 Document Object

Related Pages

HTML reference: HTML <html> tag

JavaScript reference: HTML DOM HTML Object


❮ Document Object