title: validate textarea depending on dropdown selection using jquery
body: <p>I'm using JQuery Validation plugin (<a href="http://jqueryvalidation.org" rel="nofollow">http://jqueryvalidation.org</a>) to validate an html form. I would like the textarea field to be required only if the dropdown menu selection value is 0. Any help would be great. Thanks in advance!</p>
  
  <p>Here's what the form looks like:</p>
  
  <pre><code>&lt;form name="reviewProduct" id="reviewProduct" method="POST"&gt;
      &lt;select id="reaction" name="reaction"&gt;
      &lt;option value="1"&gt;Yes. I like it.&lt;/option&gt;
      &lt;option value="0"&gt;No. I don't like it.&lt;/option&gt;
      &lt;/select&gt;
      &lt;textarea id="explainwhy" name="explainwhy" rows="4"&gt;&lt;/textarea&gt;
  &lt;/form&gt;
  
  &lt;script&gt;    
  $(document).ready(function () {
  $('#reviewProduct').validate({
      rules: {
          explainwhy: {
              required: {
                  depends: function () {
                      return $('#reaction').val() == "0";
                  }
              }
          }
      }
  });
  });
  &lt;/script&gt;
  </code></pre>