documentElement (W3C DOM Core property)

Spec
Version Depr. Static Read-only
DOM1 No No Yes
Browser support (more…)
IE5.5+ FF1.5+ SA1.3+ OP9+
Full Full Full Full

Example

var root = document.documentElement;

The example above saves a reference to this document's documentElement. The reference can then be used to called methods of that element, such as getElementsByTagName or setAttribute.

Description

A shortcut property that refers to the document's root Element node; in HTML this would be the html element.

This property is readonly.

Compatibility

Internet Explorer Firefox Safari Opera
5.5 6.0 7.0 1.5 2.0 3.0 1.3 2.0 3.0 9.0 9.5
Full Full Full Full Full Full Full Full Full Full Full

No known issues.

User-contributed notes

Related Products