Skip to content

Instantly share code, notes, and snippets.

@toddlahman
Last active January 18, 2020 09:40
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save toddlahman/6302114 to your computer and use it in GitHub Desktop.
Save toddlahman/6302114 to your computer and use it in GitHub Desktop.
Prevent Duplicate Form Submissions with jQuery
jQuery(function() {
$("form").submit(function() {
// submit more than once return false
$(this).submit(function() {
return false;
});
// submit once return true
return true;
});
});
/* or */
jQuery('form').submit(function(){
$(this).find(':submit').attr( 'disabled','disabled' );
});
@trngon
Copy link

trngon commented Apr 3, 2019

Thanks! That's really helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment