title: conditional validation in jquery
body: <p>I am having two methods to validate the zipcode.</p>
  
  <p>I am having country list box, Here if i select usa i need to validate using   <strong>usazipRegex</strong> method or if i selects canada i need to validate using <strong>canadazipRegex</strong> . suppose i selects any other country just i need <strong>required</strong></p>
  
  <pre><code>//USA zipcode validation methode 
  jQuery.validator.addMethod("usazipRegex", function(value, element) {
          return this.optional(element) || /^[0-9]{5}(?:-[0-9]{4})?$/i.test(value);
      }, "You must enter your postal code in this format: #####-####");
  
  
  //Canada zipcode validation methode 
  jQuery.validator.addMethod("canadazipRegex", function(value, element) {
          return this.optional(element) || /^[ABCEGHJ-NPRSTVXY]{1}[0-9]{1}[ABCEGHJ-NPRSTV-Z]{1}[ ]?[0-9]{1}[ABCEGHJ-NPRSTV-Z]{1}[0-9]{1}$/i.test(value);
      }, "You must enter your postal code in this format: A#A  #A#");
  </code></pre>
  
  <p>validation plugin
  <a href="http://bassistance.de/" rel="nofollow">http://bassistance.de/</a></p>
  
  <p>How can i do this.Suggest me !</p>