What is dom? Part 3

The document Object



There is a predefined document object in JavaScript, which can be used to access all elements on the DOM.
In other words, the document object is the owner (or root) of all objects in your webpage.
So, if you want to access objects in an HTML page, you always start with accessing the document object.
For example:document.body.innerHTML = "Some text";
As body is an element of the DOM, we can access it using the document object and change the content of the innerHTMLproperty.
The innerHTML property can be used on almost all HTML elements to change its content.

Comments