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?
This is one area where I like to extend jQuery:
$.fn.disable = function() {
return this.each(function() {
if (typeof this.disabled != "undefined") this.disabled = true;
});
}
$.fn.enable = function() {
return this.each(function() {
if (typeof this.disabled != "undefined") this.disabled = false;
});
}
and then you can do:
$("#button").disable();
$("#button").enable();
I find myself disabling/enabling controls a lot.