Created
January 13, 2011 17:03
-
-
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
This file contains hidden or 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
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); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
made a repo for it, may add form submit support for it next. https://github.com/ssoroka/prevent_doubleclick.js