title: Validating fields when submitting form Jquery
body: <p>I am really new to Jquery, but want to learn it. I came quite far with the tutorial all over the web, but now I want to validate a form before submitting it, and I can't find a simple example for this.</p>
  
  <p>I have a form:</p>
  
  <pre><code>&lt;form id="testform"&gt;
  &lt;input name="test" type="input"&gt;
  &lt;input type="submit" value="TEST"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I have this function:</p>
  
  <pre><code>$(document).ready(function() {
          $('#testform').submit(function(){
  
  
              $.get('test.php', $(this).serialize(), function(data){
                  $('#test').html(data);
              });             
              return false;
          });
      });
  </code></pre>
  
  <p>Now what I want is quite simple, make the background color of the name field RED of it is empty. Please explain how to do this!</p>
  
  <hr>
  
  <p>Looked at your answer, and it does not seem to work. When hitting the submit button, nothing happens, only the form clears.</p>