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 14c0329 commit 0085f1eCopy full SHA for 0085f1e
25 - Event Capture, Propagation, Bubbling and Once/index-START.html
@@ -64,6 +64,7 @@
64
// will cause event bubbling (clicking the innermost
65
// div will cause a click event on both of its parents
66
const divs = document.querySelectorAll('.main div');
67
+ const button = document.querySelector('.main button');
68
69
function logText(e) {
70
// this will cause the click event to only
@@ -81,6 +82,12 @@
81
82
// this is same as using 'removeEventListener' above ⬆
83
once: true
84
}));
85
+
86
+ button.addEventListener('click', () => {
87
+ console.log('I only log one click!');
88
+ }, {
89
+ once: true
90
+ });
91
</script>
92
</body>
93
</html>
0 commit comments