The JavaScript Tutorial

Comprehensive developer masterclass.

Chapter 5: DOM Manipulation & Event Delegation

Interact with web elements dynamically and manage user events efficiently using delegation.

const container = document.querySelector("#app");
document.addEventListener("click", (e) => {
  if (e.target.matches(".btn-action")) {
    console.log("Action clicked!");
  }
});
โ† Chapter 4