Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 18a6dab commit 48eae77Copy full SHA for 48eae77
25 - Event Capture, Propagation, Bubbling and Once/js/script.js
@@ -0,0 +1,16 @@
1
+const divs = document.querySelectorAll("div");
2
+
3
+function logText(e) {
4
+ console.llog(this.classList.value);
5
+// e.stopPropagation(); //stop bubbling
6
+ // console.log(this);
7
+}
8
9
+// document.body.addEventListener("click", logText);
10
11
+divs.forEach((div) =>
12
+ div.addEventListener("click", logText, {
13
+ capture: false, //default bubbling
14
+ once: true //unbinds itself
15
+ })
16
+);
0 commit comments