title: add red border on click jquery on inputs
body: <p>Using jQuery and HTML</p>
  
  <p>When user clicks on button, I just want to put red border if value is empty. Otherwise do not put border.</p>
  
  <p>Issue: first when you click on a button it works fine, but than if you enter a value, and hit button, than red border should be removed</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$('.mybutton').click(function() {
    if ($(".input").val().trim() == '')
      $(".input").css('border-color', 'red');
    else
      $(".input").css('border-color', '');
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.2.3/jquery.min.js"&gt;&lt;/script&gt;
  
  &lt;input type="text" name="fname1" class="input"&gt;&lt;br&gt;
  &lt;input type="text" name="fname2" class="input"&gt;&lt;br&gt;
  &lt;input type="text" name="fname3" class="input"&gt;&lt;br&gt;
  &lt;input type="text" name="fname4" class="input"&gt;&lt;br&gt;
  &lt;input type="submit" value="Submit" class="mybutton"&gt;</code></pre>
  </div>
  </div>
  </p>