X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR BOOTSTRAP XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

HTML DOM documentElement Property

Document Object Reference Document Object

Example

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

var x = document.documentElement.nodeName;

The result of x will be:

HTML

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: If the HTML element is missing, the return value is null.

Note: This property is read-only.


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 Reference Document Object


Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook