How to use jquery to disable click event of a DIV within a link?

There's a link in the DIV

<div><a href="#">go</a></div>

Can I disable click event on the DIV, but still works on the link?

I use this for test, but seems not work:

$(this).click(function(event){
    var _self_link=$('a',this);
    if(event.target!=_self_link){dosomething}
});

Any solution with Jquery? Thanks.

Answers


I think you should use stopPropagation.

Stops the bubbling of an event to parent elements, preventing any parent handlers from being notified of the event.


Need Your Help

Problems with pound sterling symbol in php mysql replacement

php mysql

I am replacing characters in my mysql database and while I can replace chacters such as $ or ~ for some I can't get it to replace the following symbol £. Why?

How to add Sharekit to existing project

iphone sharekit

How to add sharekit to existing project for sharing on social networks.