jQuery/Javascript确认出现两次 [英] jQuery/Javascript confirm coming up twice

查看:107
本文介绍了jQuery/Javascript确认出现两次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

出于某些奇怪的原因,我收到了两次确认框.这是我的代码:

For some weird reason i'm getting my confirm box coming up twice. here is my code:

$(".DeleteComment").live("click", function(){

    var CommentID = $(this).attr("rel");
    var confirm

    if (!confirm('Are you sure you want to permanently delete this comment?')){

        return false;

    }else{
        $(this).html("loading").css("color", "#999");
        //AJAX HERE
        return false;
    }


});

推荐答案

您是否动态加载任何内容(通过Ajax)?可能是click事件两次绑定到同一元素,导致两次确认.

Do you load any content dynamically (via ajax)? It could be the case that the click event is bound to the same element twice resulting in the double confirmation.

这篇关于jQuery/Javascript确认出现两次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆