Skip to content

Instantly share code, notes, and snippets.

@stephane
Created April 24, 2013 09:39
Show Gist options
  • Save stephane/5450978 to your computer and use it in GitHub Desktop.
Save stephane/5450978 to your computer and use it in GitHub Desktop.
Avoid multiple clicks on same DOM object and reactivates it after 5 seconds.
function disable_a_moment(o) {
o.disabled = true;
o.value = o.value + "…";
setTimeout(function() {
o.disabled = false;
o.value = o.value.substr(0, o.value.length - 1);
}, 5000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment