JSFiddle - React, Tailwind, and code Playground
by Yogesh Gupta
HTML
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<input id="inp">
<button>
My Button
</button>
JavaScript
function block_button(elem, min){
current=elem.val().length;
if(current>=min){
elem.next().css('opacity','1');
}else{
elem.next().css('opacity','0.5');
}
}
$('input').keyup(function(){
block_button($(this), 4);
});