开发者

JavaScript click doesn't work the second time

开发者 https://www.devze.com 2023-04-11 19:23 出处:网络
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

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

精彩评论

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

关注公众号