I have a global function to capture clicks.
$(document).click(function(e){
//do something
if(clickedOnLink)
//do something
});
I want t
I believe using is
will actually have better performance than the answers suggesting closest
:
$(e.target).is('a, a *');
This checks if the element itself is an a
or if it is contained with an a
.
This should be faster than closest
because it will use matches on the element itself and not need to traverse up the DOM tree as closest
will do.