HTML DOM Document documentElement attribute
- Föregående sida doctype
- Nästa sida documentMode
- Gå tillbaka till föregående nivå HTML DOM Documents
Definition and usage
documentElement
The property returns the document's element (as an Element object).
documentElement
It is read-only.
For HTML documents, the object returned is the <html> element.
Hint
document.body
and document.documentElement
The difference between
document.body
Returns <body> elementdocument.documentElement
Returns <html> element
See also:
Example
Get the name of the document element node:
document.documentElement.nodeName;
Syntax
document.documentElement
Return value
Type | Description |
---|---|
Object | Document's Element object. |
Browser support
document.documentElement()
It is a DOM Level 1 (1998) feature.
All web browsers support it:
Chrome | IE | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
Chrome | IE | Edge | Firefox | Safari | Opera |
Stöd | 9-11 | Stöd | Stöd | Stöd | Stöd |
- Föregående sida doctype
- Nästa sida documentMode
- Gå tillbaka till föregående nivå HTML DOM Documents