title: JQuery form string length validation
body: <p>I have some JQuery form validation where im checking the length of the username is not long for the database but it seems to be returning true eveytime.</p>
  
  <p>Am I missing something?</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;form name="contact" method"post" action=""&gt;
  &lt;fieldset&gt;
  
  &lt;label for="username" id="username_label" class="form_label"&gt;Username&lt;/label&gt;
  &lt;input type="text" name="username" id="username" size="30" value="" class="text-input" /&gt;
  &lt;label class="error" for="username" id="username_error"&gt;This field is required.        &lt;/label&gt;
  &lt;label class="error" for="username" id="username_length"&gt;Your Username should be less than 30 characters.&lt;/label&gt;
  &lt;input type="submit" name="submit" class="button" id="submit_btn" value="Send" /&gt;
  &lt;/fieldset&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>JavaScript</strong></p>
  
  <pre><code>$(function() {
  $('.error').hide();
  $(".button").click(function() {
    // validate and process form here
  
  $('.error').hide();
    var username_length = $("input#username").val().length;
      if (username_length &lt; 30) {
      $("label#username_length").show();
      $("input#username").focus();
      return false;
    }
  }
  </code></pre>