Skip to content

Instantly share code, notes, and snippets.

@ssoroka
Created January 13, 2011 17:03
Show Gist options
  • Save ssoroka/778187 to your computer and use it in GitHub Desktop.
Save ssoroka/778187 to your computer and use it in GitHub Desktop.
Prevent a link with .prevent_doubleclick class from being clicked more than once every 10 seconds; avoids multiple link submits
function do_nothing() {
return false;
}
// prevent a second click for 10 seconds. :)
$('.prevent_doubleclick').live('click', function(e) {
$(e.target).click(do_nothing);
setTimeout(function(){
$(e.target).unbind('click', do_nothing);
}, 10000);
});
@ssoroka
Copy link
Author

ssoroka commented Jan 13, 2011

made a repo for it, may add form submit support for it next. https://github.com/ssoroka/prevent_doubleclick.js

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