Animations

API

Arrays

Async

Basics

Challenges

Classes

Console

Dates

Debugging

DOM Elements

DOM Methods

DOM Navigation

DOM Properties

Event Listeners

Flow Control

Forms

Functions

Global Functions

JSON

Keywords

Libraries (3rd party)

Math

Modules

Objects

Snippets

String

Types

Widgets

Window Object

JavaScript - Root Nodes

There are two properties of the document object which allow you to get the “root” node.

  • document.body - the inner content of the body. Everything between the body tags.
  • document.documentElement - The full document. Everything between the html tags.


alert(document.body.innerHTML);
alert(document.documentElement.innerHTML);