6. Interacting with the DOM
Lesson objectives
Lesson time to deliever:
Lesson content
document.getElementById
<div id="elem">
<div id="elem-content">Element</div>
</div>
<script>
// get the element
let elem = document.getElementById('elem');
// make its background red
elem.style.background = 'red';
</script>querySelectorAll
Setting value of input field
Events
Handle button click:
Do a demo using button click to change the webpage:
Last updated