Skip to content

Instantly share code, notes, and snippets.

@javanigus
Created December 11, 2017 23:33
Show Gist options
  • Save javanigus/1d9d0a4a8fe5845822e86fb9fc2dc160 to your computer and use it in GitHub Desktop.
Save javanigus/1d9d0a4a8fe5845822e86fb9fc2dc160 to your computer and use it in GitHub Desktop.
Native JavaScript Handle Event of Dynamically-Created HTML Element
document.querySelector('div.a').addEventListener('click', function(event) {
if (event.target.className === 'a') {
// do something
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment