JSFiddle - React, Tailwind, and code Playground
by Mohamed Amer
HTML
input 1<input type="text" id="txt1" name="txt1"/> <br>input 2<input type="text" id="txt2" name="txt2" />
JavaScript
$(document).ready(function(){
$('#txt2').prop('disabled',true);
$('#txt1').on('input change' , function(){
if($.trim($(this).val()) !== ""){
$('#txt2').prop('disabled',false);
}else{
$('#txt2').prop('disabled',true);
}
});
});