documentElement

XML documents always have one root node that wraps the rest of the document. For HTML documents, the root is the <html> tag. To access the root, use the documentElement property of the document object.

document.documentElement
<html>

nodeType is 1 (an element node):

document.documentElement.nodeType
1

For element nodes, both nodeName and tagName properties contain the name of the tag.

document.documentElement.nodeName
"HTML"

document.documentElement.tagName
"HTML"

Related Tutorial
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 https://twitter.com/RookieNerdTutor https://plus.google.com/b/117136517396468545840 #
Contents +