Web Development · module 7 of 13

DOM & Events

Select elements, update content and classes, handle user events, and render lists from application state.

Course map
documentdiv.cardbutton1. capture — outermost first, heading inwards2. bubble — back out to documentstopPropagation() ends the trip early
DOM & Events — the idea in one picture

What this module covers

5 steps · Web Development

  1. Step 1. Lesson: DOM & Events

    Select elements, update content and classes, handle user events, and render lists from application state. Learning objectives - Recognize when dom & events is the right tool. - Explain the role of querySelector, addEventListener, textContent. - Build a small working example before combining it with a larger interface. - Identify one accessibility, maintainability, or error-handling improvement. Read the example, predict what it will do, then complete the small change described in the check question.

    Select elements, update content and classes, handle user events, and render lists from application state. In Web Lab, make the state/interaction visible in the UI so completion is easy to verify.

    Check yourself: [Web Lab] Use the example to demonstrate dom & events.

  2. Step 2. Quiz: DOM & Events

    Check your understanding of DOM & Events.

    addEventListener subscribes a callback to browser events such as click and input. In Web Lab, make the state/interaction visible in the UI so completion is easy to verify.

    Check yourself: [Web Lab] Complete the knowledge check.

  3. Step 3. Exercise: DOM & Events

    Create an interactive counter with increment, decrement, reset, and a message when the value reaches ten.

    This exercise turns the DOM & Events lesson into a working code change. In Web Lab, make the state/interaction visible in the UI so completion is easy to verify.

    Check yourself: [Web Lab] Does the solution use querySelector and addEventListener and textContent?

  4. Step 4. Review lab: Explain & improve DOM & Events

    Rebuild the exercise without copying the solution. Then improve it in two ways: make the code easier to understand and add one useful edge case, responsive behavior, accessibility improvement, or error state. Finally, write a short explanation of how querySelector, addEventListener, textContent work together.

    Rebuilding from memory and improving an edge case turns recognition into durable skill. In Web Lab, make the state/interaction visible in the UI so completion is easy to verify.

    Check yourself: [Web Lab] Does the improved version still use querySelector, addEventListener, textContent clearly?

  5. Step 5. Mini project: DOM & Events

    Build a filterable task board that renders from an array, handles form events, toggles completion, and deletes items.

    The mini project combines the module lesson, quiz, and exercise into one portfolio-ready result. In Web Lab, make the state/interaction visible in the UI so completion is easy to verify.

    Check yourself: [Web Lab] Does the project apply the module's dom & events skills?

Loading code lab...