JavaScript DOM

What is the DOM?

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

Each element has its 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