📜  stopImmediatePropagation - 任何代码示例

📅  最后修改于: 2022-03-11 14:58:50.097000             🧑  作者: Mango

代码示例1


Procrastination for Dummies
Copy code JAVASCRIPT /* script.js */ const credit = document.querySelector("#credit"); credit.addEventListener("click", function(event) { console.log("Nah, I'll do it later"); }); credit.addEventListener("click", function(event) { console.log("I WILL do it tomorrow"); event.stopImmediatePropagation(); }); credit.addEventListener("click", function(event) { console.log("Why do I have so much work piled up?!"); }); /* Clicking on the div block will print to the console: Nah, I'll do it later I WILL do it tomorrow */