Full stack development

Stage 1 · Lesson 5 of 8

The DOM and events

Web foundations: HTML, CSS and JavaScript

The is the live tree of objects the browser builds from your . changes the page by changing that tree. Learn to find elements with querySelector and to create new ones.

Set text with textContent. Never use innerHTML with anything a user typed, because it lets attackers run their own scripts (). Listen for clicks and key presses with addEventListener.

Events bubble: they travel up from the clicked element through its parents. That allows event delegation, where one listener on a list handles clicks on every item, even ones added later. In a form's submit handler, call event.preventDefault() to stop the full page reload.

Doing this by hand once makes feel like a relief rather than magic in the next stage.

A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock

Resources for this stage

Start with· follow one of these

  • CoursePaid
    Grokking JavaScript Fundamentals

    Design Gurus · Beginner · $50

    Guided course on the language core if you want structure and quizzes

  • CourseFree
    The Odin Project

    The Odin Project · Beginner

    Free Foundations course: HTML, CSS and JavaScript built in your own editor

Practise

  • Real designs to rebuild, so layout and interactivity get proper practice

Keep handy

  • The reference for HTML, CSS, JavaScript and browser APIs

  • Quick syntax lookups for HTML, CSS and JavaScript while you build

Also worth your time

Mark this stage as not done?