Skip to content

Instantly share code, notes, and snippets.

@folmert
Last active August 29, 2015 14:22
Show Gist options
  • Save folmert/7115a8fe286ee671804c to your computer and use it in GitHub Desktop.
Save folmert/7115a8fe286ee671804c to your computer and use it in GitHub Desktop.
if( e.target === this ) {
return "clicked element is parent";
}
else {
return "clicked element is child"
}
// "this" always refers to the DOM element the listener was attached to,
// event.target is the actual DOM element that was clicked.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment