Skip to content

Instantly share code, notes, and snippets.

@dharma017
Created September 29, 2016 06:46
Show Gist options
  • Save dharma017/f89f8d72731282e7b24391a6879f70f5 to your computer and use it in GitHub Desktop.
Save dharma017/f89f8d72731282e7b24391a6879f70f5 to your computer and use it in GitHub Desktop.
jQuery Prevent Multiple Form Submit
$(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