title: jQuery radio validation - highlight all labels for radio
body: <p>I'm using jQuery validation to validate a form with a radio button set on it (set = two radio buttons for this example).  The radio buttons with labels are below.  The form is on a jQueryUI dialog.</p>
  
  <pre><code>&lt;input type="radio" name="chooseMe" value="Yes" id="radio_yes" /&gt;&lt;label for="radio_yes"&gt;Yes&lt;/label&gt;
  &lt;input type="radio" name="chooseMe" value="No" id="radio_no" /&gt;&lt;label for="radio_no"&gt;No&lt;/label&gt;
  </code></pre>
  
  <p>I grabbed the highlight/unhighlight code from the validation plugin page on jquery.com
  <a href="http://docs.jquery.com/Plugins/Validation/validate" rel="nofollow">http://docs.jquery.com/Plugins/Validation/validate</a><br>
  (go to the "Options" tab and search for "unhighlight")</p>
  
  <pre><code>highlight: function (element, errorClass, validClass) {
      $(element).addClass(errorClass).removeClass(validClass);
      $(element.form).find("label[for=" + element.id + "]").addClass(errorClass);
  },
  unhighlight: function (element, errorClass, validClass) {
      $(element).removeClass(errorClass).addClass(validClass);
      $(element.form).find("label[for=" + element.id + "]").removeClass(errorClass);
  },
  </code></pre>
  
  <p>The first problem i'm having is when validated as required, only the "Yes" label is highlighted.<br>
  The second problem is if I don't resolve the validation issue and cancel out of the jQueryUI dialog, then come back into the dialog, the "Yes" label disappears completely.</p>
  
  <p>To resolve the first issue, what i want to do is highlight both the "Yes" and "No" labels.  So, working on the highlight code, i would need to get the name of the input ("chooseMe") from the element id, then from that name, for all the id's associated with that name ("radio_yes" and "radio_no"), highlight all the labels.  Of course, then there's the converse for the unhighlight code.</p>
  
  <p>Since i have several radio button sets in the form, i need this to be generic (no hardcoding "chooseMe", etc.)</p>
  
  <p>Does that sound reasonable?  If so, the only problem is i don't know how to do that :)</p>
  
  <p>Thanks in advance.</p>
  
  <p>jsFiddle as requested:<br>
  <a href="http://jsfiddle.net/Bd688/4/" rel="nofollow">http://jsfiddle.net/Bd688/4/</a></p>