-
-
Save zdimaz/f18eeaf6462d04bda76034747a8b8a9c to your computer and use it in GitHub Desktop.
click target (not child)
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
Если 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