title: jQuery validate plug in - validating hidden elements only when visible
body: <p>I have a form that has a "Is you billing address the same as your shipping address" field. If the user clicks the radio button "No" the hidden ul#billingAddress is shown. The fields contained in ul#billingAddress are required if it is visible, that is if the ul has display:block.</p>
  
  <p>How do I write a custom addMethod for jquery validate.js that requires those only if the field is visible? This is what I have that isn't working.</p>
  
  <pre><code>$.validator.addMethod ("BillingSameAsShipping", function(value, element) {
     var billingFields = ['billingAddress1','billingAddress2','billingCity','billingState','bilingZip']
     if ($("#billingAddress").is('visible') &amp;&amp; billingFields.val('') {
         return false;
     } else 
         return true;
   }, "Please fill in the required billing information" );
  </code></pre>
  
  <p>This, obviously is jacked. I need to make it work for each one that is in the var.</p>
  
  <p>Thanks!</p>