unbind onclick event for 'a' inside a div with onclick event
问题 html: <div id="container"> <div class="desc">desc</div> <a href="foo.php">foo</a> </div> js: $('#container').click(function(){ ... my_function(); ... }); This works when the user click inside container except for the a tag. If the user click a tag, the click event fires. However, I want to disable self-defined click function for a tag. That is, link to the page without the onlick event. This doesn't work: $('#container :not(a)').click(); 回答1: Check if the event originates from the a tag, like