JSFiddle - React, Tailwind, and code Playground
HTML
<input id="text">
<input id="send" type="button" value="send"/>
<div id="message"></div>
JavaScript
$('#send').click(function(){
var button = $(this);
button.attr('disabled', 'disabled');
setTimeout(function() {
button.removeAttr('disabled');
},3000);
if(!$('#text').val()){
alert('field empty');
button.removeAttr('disabled');
}else{
$('#message').html('done');
$('#text').val('');
}
});