title: Checkbox Validation with Jquery Script
body: <p>How do I validate checkboxes using this validation script?
  I've tried many different ways to no avail. This is a validation script was on a contact form that I modified for my purposes but cannot figure out how to validate chekboxes with it. Here is my form and validation code.</p>
  
  <pre><code>    &lt;form id="contactForm" action="send-mail.php" method="post"&gt;
      &lt;table width="492"&gt;
        &lt;tr&gt;
      &lt;th&gt;&lt;label&gt;Title:&lt;/label&gt;&lt;/th&gt;
           &lt;td&gt;&lt;input name="title"  id="title" type="text" class="form-poshytip" title="Enter your first name" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
        &lt;tr&gt;
      &lt;th&gt;&lt;label&gt;Name:&lt;/label&gt;&lt;/th&gt;
           &lt;td&gt;&lt;input name="name"  id="name" type="text" class="form-poshytip" title="Enter your first name" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
                  &lt;tr&gt;
                     &lt;th&gt;&lt;label&gt;Email:&lt;/label&gt;&lt;/th&gt;
                       &lt;td&gt;&lt;input name="email"  id="email" type="text" class="form-poshytip" title="Enter your email" /&gt;&lt;/td&gt;                                 &lt;/tr&gt;                               
                      &lt;tr&gt;
                      &lt;th&gt;&lt;label&gt;Company:&lt;/label&gt;&lt;/th&gt;
                      &lt;td&gt;&lt;input name="company"  id="company" type="text" class="form-poshytip" title="Enter your company" /&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                       &lt;tr&gt;
                      &lt;th&gt;&lt;label&gt;Phone: (with area code)&lt;/label&gt;&lt;/th&gt;
                      &lt;td&gt;&lt;input name="phone"  id="phone" type="text" class="form-poshytip" title="Enter your phone" /&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                      &lt;th&gt;&lt;label&gt;Fax:&lt;/label&gt;&lt;/th&gt;
                      &lt;td&gt;&lt;input name="fax"  id="fax" type="text" class="form-poshytip" title="Enter your fax" /&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                       &lt;tr&gt;
                      &lt;th&gt;&lt;label&gt;Street:&lt;/label&gt;&lt;/th&gt;
                       &lt;td&gt;&lt;input name="street"  id="street" type="text" class="form-poshytip" title="Enter your first name" /&gt;&lt;/td&gt;
                       &lt;/tr&gt;
                        &lt;th&gt;&lt;label&gt;City:&lt;/label&gt;&lt;/th&gt;
                       &lt;td&gt;&lt;input name="city"  id="city" type="text" class="form-poshytip" title="Enter your city" /&gt;&lt;/td&gt;
                       &lt;/tr&gt;
                        &lt;th&gt;&lt;label&gt;State:&lt;/label&gt;&lt;/th&gt;
                       &lt;td&gt;&lt;input name="state"  id="state" type="text" class="form-poshytip" title="Enter your state " /&gt;&lt;/td&gt;
                       &lt;/tr&gt;
                        &lt;th&gt;&lt;label&gt;Zip:&lt;/label&gt;&lt;/th&gt;
                       &lt;td&gt;&lt;input name="zip"  id="zip" type="text" class="form-poshytip" title="Enter your first name" /&gt;&lt;/td&gt;
                       &lt;/tr&gt;
                       &lt;tr&gt;
                      &lt;th colspan="2"&gt;&lt;label&gt;Message:&lt;/label&gt;&lt;/th&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                      &lt;th&gt;&lt;/th&gt;
                      &lt;td&gt;&lt;textarea  name="comments"  id="comments" rows="5" cols="20" class="form-poshytip" title="Enter your comments"&gt;&lt;/textarea&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                             &lt;tr&gt;
                      &lt;th colspan="2"&gt;&lt;label&gt;Please Choose:&lt;/label&gt;&lt;/th&gt;
                      &lt;/tr&gt;
                       &lt;tr&gt;
                       &lt;td&gt;&lt;p&gt;
                         &lt;label&gt;
                            &lt;input  style="width:10%;" type="checkbox" name="checkbox[]" value="Initial Free Consultation" id="CheckboxGroup1"  class="options"/&gt;
                         Initial Free Consultation&lt;/label&gt;
                         &lt;br /&gt;
                         &lt;label&gt;
                           &lt;input style="width:10%;"  type="checkbox" name="checkbox[]" value=" Internal or External Audit" id="CheckboxGroup2" class="options"/&gt;
                         Internal or External Audit&lt;/label&gt;
                         &lt;br /&gt;
                         &lt;label&gt;
                           &lt;input style="width:10%;"  type="checkbox" name="checkbox[]" value="Security / Compliance Consulting" id="CheckboxGroup3" class="options"/&gt;
                         Security / Compliance Consulting&lt;/label&gt;
                         &lt;br /&gt;
                         &lt;label&gt;
                           &lt;input style="width:10%;" type="checkbox" name="checkbox[]" value="Risk Assessment" id="CheckboxGroup4" class="options"/&gt;
                         Risk Assessment&lt;/label&gt;
                         &lt;br /&gt;
                         &lt;label&gt;
                           &lt;input style="width:10%;" type="checkbox" name="checkbox[]" value="Compliance Readiness" id="CheckboxGroup5" class="options"/&gt;
                         Compliance Readiness&lt;/label&gt;
                         &lt;br /&gt;
                       &lt;/p&gt;&lt;/td&gt; 
                      &lt;td&gt;&lt;p&gt;
                        &lt;label&gt;
                          &lt;input style="width:10%;" type="checkbox" name="checkbox[]" value=" Risk Mitigation" id="CheckboxGroup6" class="options"/&gt;
                          Risk Mitigation&lt;/label&gt;
                        &lt;br /&gt;
                        &lt;label&gt;
                          &lt;input style="width:10%;" type="checkbox" name="checkbox[]" value="Technical Staffing" id="CheckboxGroup7" class="options" /&gt;
                          Technical Staffing&lt;/label&gt;
                        &lt;br /&gt;
                        &lt;label&gt;
                          &lt;input style="width:10%;"  type="checkbox" name="checkbox[]" value="Pen Testing" id="CheckboxGroup8" class="options"/&gt;
                          Pen Testing&lt;/label&gt;
                        &lt;br /&gt;
                        &lt;label&gt;
                          &lt;input style="width:10%;"  type="checkbox" name="checkbox[]" value="Compliance Products" id="CheckboxGroup9" class="options"/&gt;
                          Compliance Products&lt;/label&gt;
                        &lt;br /&gt;
                        &lt;label&gt;
                          &lt;input style="width:10%;" type="checkbox" name="checkbox[]" value="Other" id="CheckboxGroup10" class="options"/&gt;
                          Other&lt;/label&gt;
                        &lt;br /&gt;
                        &lt;/p&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                      &lt;td&gt;&lt;input style="position:relative; z-index:100;" type="submit" value="Submit" name="submit" id="submit" /&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                       &lt;/table&gt;
                       &lt;input type="hidden" value="jfhepperle@gmail.com" name="to" id="to" /&gt;
                                  &lt;input type="hidden" value="" name="from" id="from" /&gt;
                                  &lt;input type="hidden" value="" name="subject" id="subject" /&gt;
                                  &lt;input type="hidden" value="" name="sendMailUrl" id="sendMailUrl" /&gt;
                          &lt;p id="error" style="position class="warning"&gt;Message&lt;/p&gt;
                          &lt;/form&gt;
                          &lt;p id="success" class="success"&gt;Thanks for your comments.&lt;/p&gt;
  </code></pre>
  
  <p>Jquery</p>
  
  <pre><code> jQuery(document).ready(function($) {
  
  // hide messages 
  $("#error").hide();
  $("#success").hide();
  
  // on submit...
  $("#contactForm #submit").click(function() {
      $("#error").hide();
  
      //required:
  
          var title = $("input#title").val();
      if(title == ""){
          $("#error").fadeIn().text("Title required.");
          $("input#title").focus();
          return false;
      }
  
      //name
      var name = $("input#name").val();
      if(name == ""){
          $("#error").fadeIn().text("Name required.");
          $("input#name").focus();
          return false;
      }
  
          //email
      var email = $("input#email").val();
      if(email == ""){
          $("#error").fadeIn().text("Email required.");
          $("input#email").focus();
          return false;
      }
  
  
      var company = $("input#company").val();
      if(company == ""){
          $("#error").fadeIn().text("Company required.");
          $("input#company").focus();
          return false;
      }
  
      // phone
      var phone = $("input#phone").val();
      if(phone == ""){
          $("#error").fadeIn().text("Phone required");
          $("input#phone").focus();
          return false;
      }
  
          //fax
      var fax = $("input#fax").val();
      if(fax == ""){
          $("#error").fadeIn().text("Fax required.");
          $("input#fax").focus();
          return false;
      }
  
      var street = $("input#street").val();
      if(street == ""){
          $("#error").fadeIn().text("Street required.");
          $("input#street").focus();
          return false;
      }
  
      var city = $("input#city").val();
      if(city == ""){
          $("#error").fadeIn().text("City required.");
          $("input#city").focus();
          return false;
      }
  
      var state = $("input#state").val();
      if(state == ""){
          $("#error").fadeIn().text("State required.");
          $("input#state").focus();
          return false;
      }
  
      var zip = $("input#zip").val();
      if(zip == ""){
          $("#error").fadeIn().text("Zip code required.");
          $("input#zip").focus();
          return false;
      }
  
      // comments
      var comments = $("#comments").val();
  
      // send mail php
      var sendMailUrl = $("#sendMailUrl").val();
  
      //to, from &amp; subject
      var to = $("#to").val();
      var from = $("#from").val();
      var subject = $("#subject").val();
  
      // data string
      var dataString = 'title='+ title
                      + '&amp;name=' + name                        
                      + '&amp;email=' + email
                      + '&amp;company=' + company 
                      + '&amp;phone=' + phone 
                      + '&amp;fax=' + fax
                      + '&amp;street=' + street 
                      + '&amp;city=' + city 
                      + '&amp;state=' + state
                      + '&amp;zip=' + zip 
                      + '&amp;comments=' + comments
                      + '&amp;to=' + to
                      + '&amp;from=' + from
                      + '&amp;subject=' + subject;                                 
      // ajax
      $.ajax({
          type:"POST",
          url: sendMailUrl,
          data: dataString,
          success: success()
      });
  });  
  
  
  // on success...
   function success(){
      $("#success").fadeIn();
      $("#contactForm").fadeOut();
   }
  
  return false;
  </code></pre>
  
  <p>});</p>