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

How to store and reproduce jQuery events

javascript json jquery

I am trying to store jQuery events in DB.

C#/NHibernate: Association references unmapped class

c# nhibernate

I have been struggling with this NHibernate issue for hours. I extensively researched on the web as well as the NHibernate documentation, and I can make no sense of this issue. I'm relatively new to

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.