title: jquery keep checking if input is empty of not
body: <p>I want to check if the input is empty or not <strong>while the user is typing</strong></p>
  
  <p>this is my code </p>
  
  <pre><code>$('#visitID').on('change', function () {
          if ($('#visitID').val().length == 0) {
              $("#saveandclosebutton").hide();
          } else {
              $("#saveandclosebutton").show();
          }
      });
  </code></pre>
  
  <p>but the <code>saveandclosebutton</code> never becomes hidden even though if my input is empty.</p>