开发者

How to avoid the below div from receiving the event?

I have a div called "lower", and a div called "upper". The lower div has a dblclick event, and the upper div is nested inside "lower" (and appears on top) of the lower div. There is no dblclick event on the upper div.

How can I prevent the lower div from receiving the double click event when I double click the upper div?

$('#lower').dblclick(function(e){ 
    alert("event o开发者_JAVA技巧ccurred !");
});


If as @thejh suggests #upper is inside #lower, you could try this

$('#upper').dblclick(function(e){ 
            e.stopPropagation();
    }); 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜