title: jQuery - Show error on blank form fields on submit
body: <p>I have an HTML form that puts an asterisk on each label when the user tries to submit it with fields left blank. However, it only puts an asterisk on the first label that is left blank, not all of them. Here's my HTML:</p>
  
  <pre><code>&lt;label for="name"&gt;&lt;span class="asterisk"&gt;* &lt;/span&gt;Name&lt;/label&gt;
  &lt;input type="text" id="name" name="name" class="required" /&gt;
  
  &lt;label for="email"&gt;&lt;span class="asterisk"&gt;* &lt;/span&gt;Email&lt;/label&gt;
  &lt;input type="text" id="email" name="email" class="required" /&gt;
  
  &lt;label for="company"&gt;&lt;span class="asterisk"&gt;* &lt;/span&gt;Company&lt;/label&gt;
  &lt;input type="text" id="company" name="company" class="required" /&gt;
  
  &lt;label for="address"&gt;&lt;span class="asterisk"&gt;* &lt;/span&gt;Address&lt;/label&gt;
  &lt;input type="text" id="address" name="address" class="required" /&gt;
  
  &lt;label for="favColor"&gt;&lt;span class="asterisk"&gt;* &lt;/span&gt;Favorite Color&lt;/label&gt;
  &lt;input type="text" id="favColor" name="favColor" value="N/A" /&gt;
  </code></pre>
  
  <p>And here's my jQuery:</p>
  
  <pre><code>$(function() {
      $('.submit').click(function() {
      if ($('#name').val().length == 0) {
          $('label[for="name"] .asterisk').show();
          return false;
          }
      if ($('#email').val().length == 0) {
          $('label[for="email"] .asterisk').show();
          return false;
          }
      if ($('#company').val().length == 0) {
          $('label[for="company"] .asterisk').show();
              return false;
          }
      if ($('#address').val().length == 0) {
          $('label[for="address"] .asterisk').show();
          return false;
          }
      if ($('#favColor').val().length == 0) {
          $('label[for="favColor"] .asterisk').show();
          return false;
          }
      else {
          $('.right').stop().animate({scrollTop: 0}, { duration: 1500, easing: 'easeOutQuart'});
          }
      });
  });
  </code></pre>
  
  <p>Please pardon the n00bish jQuery. If anyone can come up with a simple solution on how to make the asterisk in the span tags appear on all of the fields left blank on submit, that would be awesome!</p>