title: Jquery Unobtrusive Validation: add class to label of invalid field
body: <p>I'm using jQuery Unobtrusive Validation in an ASP.NET MVC project and validation attributes on properties in a ViewModel.</p>
  
  <p>I have the following code from my form in a partial view:</p>
  
  <pre><code>&lt;div id="contact-form"&gt;
    &lt;p&gt;
      &lt;label for="Name"&gt;Name&lt;/label&gt;
      &lt;span class="field-validation-error" data-valmsg-for="Name" data-valmsg-replace="true"&gt;&lt;span for="Name" generated="true" class=""&gt;field is required&lt;/span&gt;&lt;/span&gt; &lt;br&gt;
      &lt;input class="input-validation-error" data-val="true" data-val-required="field is required" id="Name" name="Name" placeholder="Full Name" type="text" value=""&gt;
    &lt;/p&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/JRnmg.png" alt="enter image description here"></p>
  
  <p><strong>Q:</strong> How can I add a class to the labels of the invalid fields so that when the validation message appears next to the labels, the labels should be red also, using jQuery?</p>