โจbuttons A, B, C
browser โฉ event โฉ .target โฉ example โฉ buttons A,B,C
replit โฉ buttons A, B, C
// register handler on parent
document.body.addEventListener("click", event => {
// โญ๏ธ check if button is clicked
if (event.target.nodeName === "BUTTON") {
console.log(`๐ button "${event.target.textContent}" clicked ...`);
}
});
Last updated
Was this helpful?