title: jQuery Validator - How to validate against non-form items?
body: <p>I have a form where a user can keep adding items to a list. When they go to submit this page, I want to validate that this list actually has items in it (not the individual items as they've already been validated). Each item gets added to a new row in a table with the TR having an extra attribute of "action"... so it looks like: </p>
  
  <pre><code>&lt;tr action="whatever"&gt;...&lt;/tr&gt;
  </code></pre>
  
  <p>What I was attempting to do is add a custom addMethod that called a function which would count the number of rows with action as an attribute:</p>
  
  <pre><code>$("#tableID").find("tr[action]").length
  </code></pre>
  
  <p>and if that length is greater than 0, it returns true, otherwise, false.</p>
  
  <p>This works fine outside of the validator calls but for some reason it completely skips over it.</p>
  
  <p>I could really use an example or some insight into how to make it validate this rule even though it is not a form element specifically.</p>
  
  <p><strong>Scaled down code:</strong></p>
  
  <p>*<em>note that I already have defaults being setup for messages and what not.</em></p>
  
  <pre><code>$.validator.addMethod("validProductList", function (value, element) {
          return this.optional(element) || validateProductList();
      }, "You have no products in your list");
  
  $("#processForm").click(function () {
          $("#pageForm").validate({
              submitHandler: function () {
                  $("#errors").hide();
                  //processPage();
              },
              rules: {
                  //other rules,
                  validProductList: true
              }
          });
      });
  
  function validateProductList() {
      var isValid = false;
      var useList = $("#tblAddedProducts").find("tr[action]").length;
      if (useList &gt; 0) { isValid = true; }
      return isValid;
  }
  </code></pre>