Building Interactive Websites - JavaScript and The DOM Cheatsheet - Codecademy
Building Interactive Websites - JavaScript and The DOM Cheatsheet - Codecademy
HTML DOM
The DOM is an interface between scripting languages
and a web page’s structure. The browser creates a
Document Object Model or DOM for each of the
webpage it renders. The DOM allows scripting
languages to access and modify a web page. With the
help of DOM, JavaScript gets the ability to create
dynamic HTML.
console.log(paragraph.id) // "intro"
</scrip>
</div>
<script>
const firstChild =
document.getElementById('first-child');
</script>
<script>
const box = document.querySelector('p');
// Outputs '<p>Hello there!</p>':
console.log(box.innerHTML)
// Reassigns the value:
box.innerHTML = '<p>Goodbye</p>'
</script>
const navMenu
= document.getElementById('main-navigation');
const firstButtonChild
= navMenu.querySelector('.button');