开发者

JavaScript click doesn't work the second time

I have a jQuery script to delete a message. The first time I click the link everything works fine. I click the delete link and a confirm d开发者_运维知识库ialog appears. Upon confirmation it redirects to another page and then back. However, the second time I click the link nothing happens.

$(document).ready(function(){
    $("a.del").click(function(){
        var conf = confirm("Confirmation message"); 
        if(conf == true)
            return true;
        else
            return false;
    });
});

Click function must work every click event.


I did it by not writing into $(document).ready(function(){});

Like:

$("a.del").click(function(){
    var conf = confirm("Confirmation message"); 
    if(conf == true)
        return true;
    else
        return false;
});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜