I have a click bound as live to an element. The handler returns false after execution, but if the element happens to be an A tag, then the link is also not followed, which is unacceptable…
$('*').live('click', function(){
// lots of code here
return false;
});
Now if the element that is clicked on has a path like A>img and the image is clicked on, the A will never be followed. I dont want the click event to propagate any further.
how do I achieve this?
Edit:
It is essential for my application to bind the event to *. Also, the clicks can be made on any element, not just A’s. Thus none of the mentioned solutions are suitable for what I wish to achieve.
I would not bind a click function to
*. You could bind it to thebodyelement; the click will propagate from the element that was clicked to thebodyelement. You can check the element that was originally clicked like this:Having said that, you can still do this: