Quiz Entry - updated: 2026.10.29
What are the two basic building blocks of client-side interactivity in a web frontend?
Querying/modifying the HTML document via the DOM, and reacting to user actions and system events — every interactive feature combines these two.
A web page becomes an application in the browser through exactly two capabilities working together:
- Read and change the document — JavaScript queries the DOM (Document Object Model, the browser's object tree of the page) and modifies content, structure, attributes, and CSS classes.
- React to events — code registers handler functions that run when the user acts (click, typing) or the system signals something (page loaded, timer expired).
Every frontend pattern is built from this pair: a reactive form listens for input events (2) and updates a preview element (1); an image carousel waits for a timer (2) and swaps an image's src attribute (1).
All of this runs locally in the client (browser) — no server round-trip is needed. The frontend only talks to the backend over HTTP when it actually needs data or wants to submit something.
Go deeper:
DOM scripting introduction (MDN) — the two halves in one tutorial: querying/changing the document and wiring up events.