title: jQuery validate change color of element background
body: <p>jQuery.validate doesn't seem to change the background color of the invalid element by default. Is it also possible to change the background color of a <code>select</code> element? Most of my elements are <code>input type="text"</code>, but I need an indicator for the select form elements. I am <strong>not</strong> using the default generated messages, as they don't fit my layout.</p>
  
  <p>The following code <em>does</em> change the background color of the <code>input</code> elements, but it never reverts to its previous style:</p>
  
  <pre>
   $('form[name="register"]').validate({
          errorClass: 'jqInvalid',
          rules: {
              fnameCreate: "required", //input
              monthCreate: "required", //select
              emailCreate: { required: true, email: true }, //input
              passwordCreate: "required", //input type=password
          },
          messages: {
              fnameCreate: "",
              monthCreate: "",
              emailCreate: "",
              passwordCreate: "",
          },
          errorPlacement: function (error, element) {
              element.css('background', '#ffdddd');
          }
      });
  </pre>
  
  <p><strong>Edit</strong> (sample)</p>
  
  <pre><code>&lt;div class="field"&gt;
    &lt;div class="labelName_fb"&gt;
      &lt;label for="email"&gt;Email&lt;/label&gt;
    &lt;/div&gt;
    &lt;div class="divforText3"&gt;
      &lt;div class="divLeft"&gt;&lt;/div&gt;
      &lt;div class="textbox-image3"&gt;
        &lt;input class="txt required" id="emailCreate" name="emailCreate" value="" maxlength="100" type="text"  style='width:180px'&gt;
      &lt;/div&gt;
      &lt;div class="divright"&gt;&lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Where the <code>input</code> element is given the <code>jqInvalid</code> error class on error.</p>
  
  <p><strong>CSS</strong></p>
  
  <pre><code>/* line 3 */ .error { background: #ffdddd; } /* I have since removed the errorClass option */
  /* line 254 */ .field .txt {background:transparent none repeat scroll 0 0;border:medium none;color:#000;font-size:11px;width:130px; margin:5px 0;}
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/j733s.jpg" alt="CSS screenshot in Chrome"></p>