JSFiddle - React, Tailwind, and code Playground
HTML
<button id="some-button">Button!</button>
JavaScript
$.fn.timedDisable = function(time) {
if (time == null) { time = 5000; }
return $(this).each(function() {
$(this).attr('disabled', 'disabled');
var disabledElem = $(this);
setTimeout(function() {
disabledElem.removeAttr('disabled');
}, time);
});
};
$(function() {
$('#some-button').timedDisable();
});