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();
});
精彩评论