Skip to content

Instantly share code, notes, and snippets.

@lucianosousa
Created August 10, 2014 22:33
Show Gist options
  • Save lucianosousa/6efea313b6f737282b29 to your computer and use it in GitHub Desktop.
Save lucianosousa/6efea313b6f737282b29 to your computer and use it in GitHub Desktop.
prevent double submission on forms
jQuery.fn.preventDoubleSubmission = function() {
$(this).on('submit',function(e){
var $form = $(this);
if ($form.data('submitted') === true) {
e.preventDefault();
} else {
$form.data('submitted', true);
}
});
return this;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment