Skip to content

Instantly share code, notes, and snippets.

@zdimaz
Last active March 16, 2020 12:43
Show Gist options
  • Save zdimaz/f18eeaf6462d04bda76034747a8b8a9c to your computer and use it in GitHub Desktop.
Save zdimaz/f18eeaf6462d04bda76034747a8b8a9c to your computer and use it in GitHub Desktop.
click target (not child)
Если e.target - это тот же самый элемент, что и this, вы не нажали на потомка.
$('.foobar').on('click', function(e) {
if (e.target !== this){
return;
};
alert( 'clicked the foobar' );
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment