JQuery Script Load Timing

前端 未结 3 1809
猫巷女王i
猫巷女王i 2020-12-28 10:55

If I have a button that sets off a jquery script is there a way to make sure the button is inactive until the script completes?

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-28 11:28

    Thanks cletus for your function. I have used your function and created my own to toggle disabled elements.

    $.fn.toggleDisable = function() {
        return this.each(function() {
            if (typeof this.disabled != "undefined"){
                    if(this.disabled){
                        this.disabled = false;
                    }else{
                        this.disabled = true;
                    }
            }
        });
    }
    

提交回复
热议问题