Created
July 8, 2011 19:46
-
-
Save skiz/1072655 to your computer and use it in GitHub Desktop.
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
$.fn.preventDoubleSubmit = function() { | |
$(this).submit(function(event) { | |
if ($(this).hasClass('submitted')){ | |
event.preventDefault(); | |
return false; | |
}else{ | |
$(this).addClass('submitted'); | |
return true; | |
} | |
}); | |
}; | |
$('form').preventDoubleSubmit(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment