JSFiddle - React, Tailwind, and code Playground

by ovfiddle

HTML

<a id="my-button" href="#">Do something for 5 seconds...</a>

CSS

a {color:blue !important;}
.disabled {color: grey !important;}

JavaScript

$('#my-button').click(function() {
    var $this = $(this); //cache the reference
    if (!$this.hasClass('disabled')) {
        $this.addClass('disabled');
        alert('hello world!');
        setTimeout(function($btn) {
            $btn.removeClass('disabled');
        }, 5000, $this);
    } else {
        return false;
    }
});