Disabling links to stop double-clicks in JQuery

前端 未结 16 744
别跟我提以往
别跟我提以往 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

    This should work when you are using a function

    var clickRunning = false;
    function OpenSth(){
         if (clickRunning) return;
         clickRunning = true;
    
         yourFunc({
          /* do your stuff*/
         },500,  function () {
            clickRunning= false;
         });
    }
    

提交回复
热议问题