JSFiddle - React, Tailwind, and code Playground

by techiedelight

HTML

<input type="text" placeholder="Enter your name...">
<button>Submit</button>

JavaScript

$(document).ready(function() {
  $('button').attr('disabled', 'disabled');
  $('input[type=text]').on('input', function() {
    if ($(this).val() !== '') {
      $('button').removeAttr("disabled");
    } else {
      $('button').attr('disabled', 'disabled');
    }
  });
});