Created
September 23, 2017 11:33
-
-
Save komagata/14748c24e63c5455b38ae03e628cc1b0 to your computer and use it in GitHub Desktop.
Event delegation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ul = document.querySelector("ul"); | |
ul.addEventListener("click", (event) => { | |
if (event.target.tagName === "LI") { | |
console.log("FOO↑↑↑"); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul> | |
<li>foo</li> | |
<li>bar</li> | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment