I have a remote_form_for. Now :onclick I want to disable the submit button and on ajax:complete I want to enable the buttons back.
:onclick disable is working fine, but enable it back using ajax:complete event is not working.
Any thoughts?
Here comes the code,
(function(jQuery){
jQuery.fn.disableWith = function(options){
var settings = jQuery.extend({
disable_event : function(e){
e.preventDefault();
return false;
}
}, options);
this.bind('click', function(){
jQuery(this).click(settings.disable_event);
});
this.bind("ajax:complete", function(){
jQuery(this).unbind('click', settings.disable_event);
});
return this;
};
})(jQuery);