Skip to content

Instantly share code, notes, and snippets.

@earth3300
Created November 22, 2018 21:30
Show Gist options
  • Select an option

  • Save earth3300/c20ab9e55f9b6abd075a8a35138d7728 to your computer and use it in GitHub Desktop.

Select an option

Save earth3300/c20ab9e55f9b6abd075a8a35138d7728 to your computer and use it in GitHub Desktop.
This disabled button is enabled after three seconds via JavaScript (not jQuery).
<button id="form-submit" type="submit" class="button button-primary" disabled>Send</button>
<script>
setTimeout(function() {
var btnSubmit = document.getElementById('form-submit');
if (typeof btnSubmit !== "undefined") {
btnSubmit.disabled = false;
}
}, 3000);
</script>
@earth3300
Copy link
Author

A simple way to help prevent automated form submissions (in conjunction with other methods).

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