Home/Exercises/DOM Manipulation
exercise set · 80 challenges · beginner to hard

JavaScript DOM Manipulation Exercises

Master JavaScript DOM manipulation with interactive exercises covering querySelector, textContent, classList, events, forms, element creation and removal, data rendering, event delegation, attributes, styles, traversal, window and document APIs, and timers. Write and test real browser code with immediate feedback.

Choose your next challenge

Exercises

Work from beginner to hard, or use the filters to find a specific skill.

80exercises
About this practice set

Practice changing real webpage content

JavaScript updates webpage content by selecting DOM elements, reading or changing their properties, and responding to browser events. These JavaScript DOM manipulation exercises connect each line of code to visible page behavior, helping you build interfaces that react to clicks, input, form submissions, data, and time.

The JavaScript element-selection practice starts with document.querySelector, querySelectorAll, getElementById, scoped queries, data-attribute selectors, and selector debugging. From there, you'll read and update textContent, manage classList and attributes, apply styles, traverse parents and siblings, and create or remove real elements.

JavaScript DOM events practice and DOM rendering exercises then combine those skills in realistic interface work: counters, live input previews, validated forms, dynamic lists, empty states, dashboards, tables, filtered rerenders, delegated removal, keyboard events, custom events, accessible controls, MutationObserver, and timed updates.

Exercises
80
Difficulty
Beginner to Hard
Good to know first
Know JavaScript fundamentals and basic HTML; CSS familiarity is helpful.
Start with document.querySelector

What you’ll practice

  • Select elements with querySelector, querySelectorAll, and getElementById
  • Read and change page content safely with textContent
  • Manage classes, attributes, data attributes, styles, and ARIA state
  • Handle click, input, change, submit, keyboard, and custom events
  • Read form values, validate fields, and render form-driven lists
  • Create, append, traverse, and remove DOM elements
  • Render arrays into cards, badges, tables, and filtered interfaces
  • Use delegation, propagation, MutationObserver, window APIs, and timers

Who these exercises are for

This practice set is for learners who understand JavaScript fundamentals and want to make webpages interactive. It also suits developers refreshing element selection, DOM events, rendering, forms, accessibility state, traversal, and browser API behavior through real coding examples.

How practice works

  • Write JavaScript against a real DOM preview in your browser
  • Use instant test feedback to inspect visible interface behavior
  • Progress from one-element updates to multi-step rendered interfaces
  • Filter exercises by topic or difficulty and save progress when signed in