JSFiddle - React, Tailwind, and code Playground

Disable button for specified time Maybe needed on handling ajax calls...

by bitstarr

HTML

<button id="someButton">test</button>

<div id="output">HTML-Dummy</div>

JavaScript

var someButton = $('#someButton'),
    output = $('#output'),
    enableButton = function() {
        someButton.removeAttr('disabled');
        output.html('reset');
    };

someButton.click(function(e) {
    e.preventDefault();
    output.html('clicked');
    $(this).attr('disabled', 'disabled');
    setTimeout(enableButton, 5000);
});