Trigger action when element is clicked but not when some specific subelements are.

Posted by Anant on Stack Overflow See other posts from Stack Overflow or by Anant
Published on 2010-04-08T07:54:33Z Indexed on 2010/04/08 8:03 UTC
Read the original article Hit count: 218

Filed under:

I have a div, containing text and a few links. I want to trigger an onclick event, only if the click occurs anywhere in the div, but not on any of the links.

What would be the best way (performance wise) to implement this using jQuery?

The one I use is

$('#div').click(function(){

});

but it disables all the #div > a

© Stack Overflow or respective owner

Related posts about jQuery