Javascript 停止内部分割的点击事件
我有两个除法,一个在另一个除法中。现在我想在单击“内部除法”时停止单击“外部除法”时执行的工作。但我不知道我的代码有什么问题。下面是:Javascript 停止内部分割的点击事件,javascript,jquery,Javascript,Jquery,我有两个除法,一个在另一个除法中。现在我想在单击“内部除法”时停止单击“外部除法”时执行的工作。但我不知道我的代码有什么问题。下面是: $(document).ready(function() { $('.notification_one').click(function() { alert($(this).attr("id")); location.href = 'shownotification.jsp?notifyidd=' + $(this).at
$(document).ready(function() {
$('.notification_one').click(function() {
alert($(this).attr("id"));
location.href = 'shownotification.jsp?notifyidd=' + $(this).attr("id");
});
$('.detele_notification').click(function() {
DoRemove(event);
alert("cross clicked" + $(this).attr("id"));
var surity = confirm("Are you sure you want to delete this Notification? ");
if (surity == true) {
location.href = 'deletenotification?idss='+$(this).attr("id");
}
});
});
function DoRemove(e){
if (!e)
var e = window.event;
e.cancelBubble = true;
if (e.stopPropagation)
e.stopPropagation();
}
这里的通知是外除法,而detele通知是内除法。请提供帮助。您在
DoRemove()
函数中有停止传播的代码,但您没有将事件包括在单击处理程序dfeinition中:
$('.detele_notification').click(function (e) { // Note 'e' here
e.stopPropagation(); // stop the click bubbling here
alert("cross clicked" + $(this).attr("id"));
var surity = confirm("Are you sure you want to delete this Notification? ");
if (surity == true){
location.href = 'deletenotification?idss='+$(this).attr("id");
}
});