title: jQuery select box validation
body: <p>I have following code in jQuery.<br>
  I need to display a validation message "Year Required" when the option value of <code>select</code> element is "0". </p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $(document).ready(function () {
     $("#register").validate({
         debug: true,
         rules: {
             year: {
                 required: function () {
                     if ($("#year option[value='0']")) {
                         return true;
                     } else {
                         return false;
                     }
                 }
             }
         },
         messages: {
             year: "Year Required",
         },
     });
  })
  &lt;/script&gt;
  </code></pre>
  
  <p>Select box</p>
  
  <pre><code>&lt;select name="year"  id="year"&gt;
      &lt;option value="0"&gt;Year&lt;/option&gt;
      &lt;option value="1"&gt;1919&lt;/option&gt;
      &lt;option value="2"&gt;1920&lt;/option&gt;
      &lt;option value="3"&gt;1921&lt;/option&gt;
      &lt;option value="4"&gt;1922&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>