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 220254c commit fa92ce1Copy full SHA for fa92ce1
25 - Event Capture, Propagation, Bubbling and Once/index-START.html
@@ -39,7 +39,24 @@
39
40
<button></button>
41
<script>
42
+ const divs = document.querySelectorAll('div');
43
+ const button = document.querySelector('button');
44
45
+ function logText(e){
46
+ console.log(this.classList.value);
47
+ // e.stopPropagation() // stops bubbling
48
+ }
49
+
50
+ divs.forEach(div => div.addEventListener('click', logText,{
51
+ capture:false,
52
+ once: true
53
+ }));
54
55
+ button.addEventListener('click', () => {
56
+ console.log('click');
57
+ }, {
58
+ once: true // removes an event after carried out
59
+ });
60
</script>
61
</body>
62
</html>
0 commit comments