Skip to content

Instantly share code, notes, and snippets.

@kadavre
Created August 5, 2013 08:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kadavre/6154261 to your computer and use it in GitHub Desktop.
Save kadavre/6154261 to your computer and use it in GitHub Desktop.
Prevent Multiple Submit of Your Form
$(document).ready(function() {
$('form').submit(function() {
if(typeof jQuery.data(this, "disabledOnSubmit") == 'undefined') {
jQuery.data(this, "disabledOnSubmit", { submited: true });
$('input[type=submit], input[type=button]', this).each(function() {
$(this).attr("disabled", "disabled");
});
return true;
}
else
{
return false;
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment