JavaScript DOM

What is the DOM?

The DOM stands for Document Object Model. It’s the representation of the contents of a webpage and a tree-like of nodes/ elements created by the browser.

Each element has its own properties and methods so we can use JavaScript to add/ write and manipulate the DOM and its elements.

We can display an interactive list of the properties of the Document Object with:

console.dir(document)

We can also examine each element:

console.log(document.domain) // Get the domain
console.log(document.url) // Get the url
console.log(document.title) // Get the title
console.log(document.doctype) // Get DOCTYPE
console.log(document.all) // Get HTMLAllCollection
console.log(document.links) // Get links