title: jQuery Validation plugin ignored elements get validated
body: <p>I validate a form with tje jQuery Validation Plugin. If the browser supports the HTML5 datetime-local element I want that input not to be validated. Everything works fine, except that the elements with the ignore class still get validated.</p>
  
  <p>HTML in Chrome (with datetime-local support)</p>
  
  <pre><code>&lt;form action="/Events/EditEventInfo/37" id="EditForm" method="post" novalidate="novalidate"&gt;&lt;input name="__RequestVerificationToken" type="hidden" value="bg5O93sGSgPSWzzsaMfKzd0FPWddBBw9ZYC4srs5xBWmJgsBKWjmD2TL0OXyQNwGl1fa7orAp08pCL1RLxzlSdbNWc9YUxxd1rxGrpw0fhgINRnd3vXoCzG5bDhe2ySk77kXfCfyEJvy-uvYRIbA8Q2"&gt;    &lt;div class="form-horizontal"&gt;
      &lt;div class="form-group"&gt;
          &lt;label for="StartDate" class="control-label col-md-2"&gt;Startdatum&lt;/label&gt;
          &lt;div class="col-md-10"&gt;
              &lt;input id="StartDate" name="StartDate" class="form-control ignore error" type="datetime-local" required="" aria-required="true" aria-invalid="true"&gt;&lt;label id="StartDate-error" class="error" for="StartDate"&gt;Bitte geben sie ein Datum im Format 'dd.MM.yyyy HH:mm' an.&lt;/label&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;div class="form-group"&gt;
          &lt;label for="EndDate" class="control-label col-md-2"&gt;Enddatum&lt;/label&gt;
          &lt;div class="col-md-10"&gt;
              &lt;input id="EndDate" name="EndDate" class="form-control ignore error" type="datetime-local" required="" aria-required="true"&gt;&lt;label id="EndDate-error" class="error" for="EndDate"&gt;Bitte geben sie ein Datum im Format 'dd.MM.yyyy HH:mm' an.&lt;/label&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;div class="form-group"&gt;
          &lt;label for="Name" class="control-label col-md-2"&gt;Name&lt;/label&gt;
          &lt;div class="col-md-10"&gt;
              &lt;input id="Name" name="Name" class="form-control valid" value="Party. Yolo." type="text" minlength="2" required="" aria-required="true"&gt;
  
          &lt;/div&gt;
      &lt;/div&gt;       
      &lt;div class="form-group"&gt;
          &lt;div class="col-md-offset-2 col-md-10"&gt;
              &lt;input type="submit" value="Speichern" class="btn btn-default"&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>Script:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;    
  $.validator.addMethod(
  "deDateTime",
  function (value, element) {
      //dd.MM.yyyy HH:mm
      var re = /^\d{2}\.\d{2}\.\d{4} \d{2}:\d{2}$/;
      return (this.optional(element) &amp;&amp; value == "") || re.test(value);
  },
  "Bitte geben sie ein Datum im Format 'dd.MM.yyyy HH:mm' an."
  );
  if (DateTimeLocalSupport())
  {
      $('#StartDate').val("@Model.StartDate.ToString("s")");
      $('#EndDate').val("@Model.EndDate.ToString("s")");
      //HTML5 input types are available, no need to validate those fields
      $('#StartDate').addClass("ignore");
      $('#EndDate').addClass("ignore");
  }
  else
  {
      $('#StartDate').val("@Model.StartDate.ToString("dd.MM.yyyy HH:mm")");
      $('#EndDate').val("@Model.EndDate.ToString("dd.MM.yyyy HH:mm")");
  }
  $('#EditForm').validate({
      ignore: ".ignore :hidden",
      rules: {
          StartDate: {
              deDateTime: true
          },
          EndDate: {
              deDateTime: true
          }
      }
  });
  alert("Valid: " + $('#EditForm').valid());
  
  &lt;/script&gt;
  </code></pre>
  
  <p>Checking for HTML5 support, populating the fields and adding classes works fine. Only does the validation plugin still validate the elements its not supposed to.</p>
  
  <p>Solution:</p>
  
  <pre><code>ignore: '.ignore, :hidden'
  </code></pre>