title: jQuery validate plugin add methods still running even if not required
body: <p>I'm using the <a href="http://docs.jquery.com/Plugins/Validation/" rel="nofollow">jQuery Validation Plugin</a> and I am adding my own methods like so:</p>
  
  <pre><code>jQuery.validator.addMethod("num", function(num) {
      if(isNaN(num))
          return false;
  
      return true;
  }, "Please enter a valid number");
  </code></pre>
  
  <p>However, even if I don't add the <code>required</code> class to a form element, this validation method will still be called and evaluate to false if the user entered nothing. But I would like the behavior to be that if an element does not have the <code>required</code> class, it is only called if the user has entered something. Is there anyway to do this? Thanks!</p>
  
  <p><b>UPDATE</b></p>
  
  <p>So the actual code that I posted above was meant to be a simple example to demonstrate the problem, however now I am putting up the specific example that is giving me issues. Here is the jsfiddle link:</p>
  
  <p><a href="http://jsfiddle.net/SVwmH/2/" rel="nofollow">http://jsfiddle.net/SVwmH/2/</a></p>
  
  <p><b>The HTML</b></p>
  
  <pre><code>&lt;form method="post"&gt;
      &lt;li&gt;
          &lt;label for="2"&gt;Mileage&lt;/label&gt;
          &lt;input type="text" name="2" id="attr_2" class="non_neg_int"
          value="" /&gt;
      &lt;/li&gt;
      &lt;li&gt;
          &lt;label for="3"&gt;VIN (Vehicle Identification Number)&lt;/label&gt;
          &lt;input type="text" name="3"
          id="attr_3" class="vin" maxlength="17" value="" /&gt;
      &lt;/li&gt;
      &lt;li&gt;
          &lt;input type="submit" /&gt;
      &lt;/li&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><b>The JS</b></p>
  
  <pre><code>$(document).ready(function () {
      var validator = $("form").validate({
          onkeyup: false,
          onblur: true,
          ignore: "",
          submitHandler: function (form) { // for demo
              alert('valid form submitted'); // for demo
              return false; // for demo
          }
      });
  });
  
  jQuery.validator.addMethod("vin", function (vin) {
      if (!(/^[A-HJ-NP-Z0-9]{17}$/.test(vin))) return false;
      return true;
  }, "Must be a valid VIN");
  
  jQuery.validator.addMethod("non_neg_int", function (non_neg_int) {
      if (isNaN(non_neg_int) || non_neg_int == null || non_neg_int == "" || non_neg_int &lt; 0 || !is_int(non_neg_int)) return false;
  
      return true;
  }, "Must be a nonnegative integer");
  
  function is_int(value) {
      if ((parseFloat(value) == parseInt(value)) &amp;&amp; !isNaN(value)) {
          return true;
      } else {
          return false;
      }
  }
  </code></pre>