jQuery/Javascript confirm coming up twice

Adam picture Adam · Nov 26, 2009 · Viewed 11.8k times · Source

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;
    }


});

Answer

Marek Karbarz picture Marek Karbarz · Nov 26, 2009

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.