Disabling links to stop double-clicks in JQuery

前端 未结 16 762
别跟我提以往
别跟我提以往 2020-12-02 11:13

How would I disable all links with the button class after they are clicked once? I\'d like to be able to do this in one place, and not have to change all of the

16条回答
  •  眼角桃花
    2020-12-02 12:03

    Events are only bound on document.ready, you should handle this with a .live event:

    $("a.button").live("click", function() { $(this).attr("disabled", "disabled"); });
    $("a[disabled]").live("click", function() { return false; });
    

提交回复
热议问题