I wrote this simple piece of code to prevent a form from being submitted more than once.
jQuery.fn.preventDoubleSubmit = function() {
this.find(":submit").each(function() {
$(this).click(function() {
this.originalValue = this.value;
this.disabled = true;
this.beenClicked = true;
});
});
// [...]
return this.submit(function() {
if (this.beenSubmitted) {
return false;
} else {
this.beenSubmitted = true;
}
});
};
// [...]
Unfortunately, with Safari it doesn't work. When I click the form the button is disabled and Safari doesn't submit the form.
Any idea?