JavaScript
🌳 The DOM and Events
Learn how JavaScript represents and manipulates a web page, and how it reacts to user actions.
What you'll learn
- Explain what the DOM is as a tree of objects and start from
documentto access the page. - Select elements with
querySelector/querySelectorAlland modify their content, attributes, classes and styles. - Create and insert elements with
createElementandappendChildto build dynamic content. - Respond to events with
addEventListenerand handle form submission usingevent.preventDefault().
Lessons
What is the DOM?The tree of objects that represents the page. Select and modify elementsquerySelector, textContent, attributes and styles. Events and formsaddEventListener, the event object and forms.Practice this module in the app
DevPath is a hands-on course: you read the theory here; in the app you put it into practice with exercises that really run, offline.
Start free in the app →