title: JQuery form validate only input type = text or type = password
body: <p>I am creating a form validation script and I have check box's on a couple forms. How can I skip these and only make my form validation check the input fields?</p>
  
  <p>Here is my example.</p>
  
  <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;&lt;/title&gt;
  &lt;meta HTTP-EQUIV="Content-Type" content="text/html; charset=UTF-8"&gt;
  &lt;META HTTP-EQUIV="Content-Language" CONTENT="en-us"&gt;
  &lt;script type="text/javascript" src="http://code.jquery.com/jquery-1.7.min.js"&gt;&lt;/script&gt;
  &lt;script&gt;
  $(function() {
      var form_default_texts = [];
      form_defaults = function(){
          $("form :input").filter("[type='text']").each(function() {
              if($(this).val()){
                  form_default_texts[$(this).name]=$(this).val();
                  $(this).blur(function(){
                      if(!$(this).val()){
                          $(this).val(form_default_texts[$(this).name]).css({color:"#EFEFEF"});
                      }
                  }).focus(function(){
                      $(this).val('').css({color:'#191919'});
                  }).css({color:'#EFEFEF'});
              }
          });
      };
      form_validate = function(form) {    
          var submit = true;
          $(form.elements).filter("[type='text'], [type='password']").each(function() {
              var field = $(this);
              if(form_default_texts[field.name] == field.val()){
                  field.focus();
                  submit=false;
              }else{
                  switch(field.attr('name')){
                  case '': case 'submit':
                      //do nothing.
                      break;
                  case 'email':
                      form_clear(field);
                      if(valid_email(field.val()) == false){
                          form_error(field);
                          if(submit){field.focus();}
                          submit = false;
                      }
                      break;
                  default:
                      form_clear(field);
                      if(field.val() == ''){
                          form_error(field);
                          if(submit){field.focus();}
                          submit = false;
                      }
                  };
              }
          });
  
          return submit;
      };
      valid_email = function(val){
          var filter = /^[a-zA-Z0-9]+[a-zA-Z0-9_.-]+[a-zA-Z0-9_-]+@[a-zA-Z0-9]+[a-zA-Z0-9.-]+[a-zA-Z0-9]+.[a-z]{2,4}$/;
          if(filter.test(val)){
              return true;
          }else{
              return false;
          }
      };
      form_clear = function(field){
          field.css({background:'#FFFEFB','border-color':'#fafaee'}).next(".error").remove();
      }
      form_error = function(field){
          var form_errors = {fullname:'How do you want to be addressed?',subj:'What is this about?',msg:'What is your message?',email:'Check your email address.',search:'blah blah',q:'testing'};
          var form_error = form_errors[field.attr('name')];
          if(!form_error){form_error='This field is required';}
  
          field.css({background:'#F8DBDB','border-color':'#E77776'}).after('&lt;span class="error"&gt;'+form_error+'&lt;/span&gt;');
      }
  
      window.onload=form_defaults;
  
  });
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div align="center"&gt;
  &lt;div class="myform" style="padding:25px 0;"&gt;
  &lt;form action="/contact/" name="contact" onsubmit="return form_validate(this);" method="POST"&gt;
  &lt;div class="fb"&gt;&lt;span class="finfo round"&gt;use this form for quick delivery of your message&lt;/span&gt;&lt;/div&gt;
  &lt;div class="fb"&gt;&lt;div class="lform round"&gt;Your Name:&lt;/div&gt;
  &lt;input type="text" name="fullname" maxlength="100" size="35" class="inputtext" value=""&gt;&lt;/div&gt;
  &lt;div class="fb"&gt;&lt;div class="lform round"&gt;Contact Email:&lt;/div&gt;
  &lt;input type="text" id="email" name="email" maxlength="100" size="35" class="inputtext" value=""&gt;&lt;/div&gt;
  &lt;div class="fb"&gt;&lt;div class="lform round"&gt;Message Subject:&lt;/div&gt;
  &lt;input type="text" id="subj" name="subj" maxlength="100" size="55" class="inputtext" value=""&gt;&lt;/div&gt;
  &lt;div class="fb"&gt;&lt;div class="lform round"&gt;Your Message:&lt;/div&gt;
  &lt;textarea id="msg" name="msg" cols="50" rows="6" class="inputtext"&gt;&lt;/textarea&gt;&lt;/div&gt;
  &lt;span&gt;&lt;input type="submit" name="submit" class="inputbutton mybutton round" value="Send Message" title="Submit Contact Form"&gt;&lt;/span&gt;
  &lt;/form&gt;
  &lt;form action="/search.php" method="GET" name="search" onSubmit="return form_validate(this);"&gt;
      &lt;input type="text" name="q" class="inputtext" value="" style="width:165px;"&gt;&lt;input type="submit" class="inputbutton round" value="Search" title="Search"&gt;
  &lt;/form&gt;
  &lt;form action="/signup.php" method="GET" name="newsletter" onSubmit="return form_validate(this);"&gt;
      &lt;input type="text" name="email" class="inputtext" value="test test asdfsdf" style="width:165px;"&gt;&lt;input type="submit" class="inputbutton round" value="Register" title="Register Account"&gt;
  &lt;/form&gt;
  &lt;form action="/signup.php" method="GET" name="search2" onSubmit="return form_validate(this);"&gt;
      &lt;input type="text" name="email2" class="inputtext" value="test test" style="width:165px;"&gt;&lt;input type="submit" class="inputbutton round" value="Register" title="Register Account"&gt;
  &lt;/form&gt;
  
  &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>Thanks guys! Updated with working example.</p>