Access Relative Nodes Back

<html>
    <head>
        <title>DOM Example</title>
    </head>
    <body>
        <p>Hello World!</p>
        <p>Isn't this exciting?</p>
        <p>You're learning to use the DOM!</p>
    </body>
</html>
  • access <html />
var objHtml = this.document.documentElement;
  • access <head /> or <body />
var objHead = objHtml.firstChild;
var objBody = objHtml.lastChild;
var objHead = objHtml.childNodes.item(0);    // objHtml.childNodes[0]
var objBody = objHtml.childNodes.item(1);    // objHtml.childNodes[1]
var objHead = this.document.head;
var objBody = this.document.body;
Empty Comments
Sign in GitHub

As the plugin is integrated with a code management system like GitLab or GitHub, you may have to auth with your account before leaving comments around this article.

Notice: This plugin has used Cookie to store your token with an expiration.