Here is my client website http://www.tswanda.co.zw/campaigns/tswanda-childrens-home/ when you click on contribute now a popup window appear with donate button, if you click on donate button 2, 3 or 4 times it submitted the value again for checkout.
I want to disable button once a money is submitted can you please help me out i tried hard use code from Disabling links to stop double-clicks in JQuery but nothing work for me.
any help will be really appreciated.
<script type="text/javascript">
function do_nothing() {
return false;
}
// prevent a second click for 10 seconds. :)
jQuery('.edd-add-to-cart').live('click', function(e) {
jQuery(e.target).click(do_nothing);
setTimeout(function(){
jQuery(e.target).unbind('click', do_nothing);
}, 50000);
});
</script>
You can disable the button when clicked, and re-enable it after 5 seconds:
try this
Inside your click handler,You are binding another click event to the target. And you’re removing that particular click handler.
Instead the try disabling the button by setting up
disabled
attribute and remove it.DEMO