Created
August 10, 2014 22:33
-
-
Save lucianosousa/6efea313b6f737282b29 to your computer and use it in GitHub Desktop.
prevent double submission on forms
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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