title: Jquery Validate dropdown required if field empty
body: <p>I'm trying to make the dropdown required if the #category field is empty.</p>
  
  <p>Thanks!</p>
  
  <p>JQUERY ATTEMPT #1:</p>
  
  <pre><code>$("#uploadDocsForm").validate({
      rules: {
          name: {
              required: true,
              minlength: 2,
              maxlength: 255  
          },
          cat_id: {
              required: function(element) {
                  return $("#category").val() == '';
              }
          }
      },
      messages: {
          name: 'Please enter a &lt;b&gt;Document Name&lt;/b&gt;.',
          cat_id: 'Please select a &lt;b&gt;Category&lt;/b&gt;.'
      }
  });
  </code></pre>
  
  <p>JQUERY ATTEMPT #2:</p>
  
  <pre><code>$("#uploadDocsForm").validate({
      rules: {
          name: {
              required: true,
              minlength: 2,
              maxlength: 255  
          },
          cat_id: {
              required: {
                  depends: function(element) {
                      return $("#category").val() == '';
                  }
              }
          }
      },
      messages: {
          name: 'Please enter a &lt;b&gt;Document Name&lt;/b&gt;.',
          cat_id: 'Please select a &lt;b&gt;Category&lt;/b&gt;.'
      }
  });
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;form name="uploadDocsForm" id="uploadDocsForm"&gt;   
      &lt;label for="name"&gt;Document Name&lt;/label&gt;
      &lt;input name="name" id="name" type="text" class="textbox"/&gt;
      &lt;label for="cat_id"&gt;Category&lt;/label&gt;
      &lt;select name="cat_id" id="cat_id" class="dropdown"&gt;
      &lt;option selected&gt;Please Select Category&lt;/option&gt;
      &lt;option&gt;------------------------&lt;/option&gt;
      &lt;option value="1"&gt;test cat&lt;/option&gt;
      &lt;/select&gt;
      &lt;label for="category"&gt;New Category&lt;/label&gt;
      &lt;input name="category" id="category" type="text" class="textbox"/&gt;
      &lt;/form&gt;
  </code></pre>