New:Embedded & IoT Bootcamp
Cheatsheet Format: Web

JavaScript DOM Cheatsheet

The selectors, traversal methods, events and mutation APIs you actually use, on one printable page.

Abhishek Sharma 2026-08-06 Programming / JavaScript

Selecting elements

document.querySelector('.card');
document.querySelectorAll('[data-role="tab"]');
element.closest('.card');
element.matches('.is-active');

Creating and inserting

const item = document.createElement('li');
item.textContent = 'New item';
list.append(item);

Events

button.addEventListener('click', (event) => {
  event.preventDefault();
  console.log(event.currentTarget);
});

Use event delegation for lists that change frequently.

Want more like this?

Browse every cheatsheets in the library, organised by topic.

All cheatsheets

Related learning

Tutorial2026-06-09

An Introduction to JavaScript

Learn what JavaScript is, its history, and how to get started with tools and the developer console

Programming / JavaScript

JavaScriptProgramming
Tutorial2026-06-09

JavaScript Fundamentals

Master the basics: Hello World, code structure, variables, data types, and type conversions

Programming / JavaScript

JavaScriptProgramming