JavaScript Essentials

Selecting Elements and Handling Events

JavaScript starts with the DOM. In this lesson you will query elements, listen for clicks, and change the page in response. The key is to make the interaction obvious and predictable rather than clever.

Work through a small counter and button pair to understand the flow from event to state change to UI update.

Edit the panels below and press Run to preview. Nothing you type here is saved — refreshing the page restores the original starter code.

Next lesson →