title: When a checkbox becomes checked, remove class from labels
body: <p>I've written a basic form validation script, and now I'm trying to reset the errors that occur if a user doesn't fill in a required field.</p>
  
  <p>For checkboxes and radio buttons, I've added the class <code>error</code> to their labels. The HTML code for this looks like this:</p>
  
  <pre><code>&lt;input class="required" id="Example31" name="Example3" type="checkbox" /&gt;
  &lt;label for="Example31" class="error"&gt;Example Input 3 Option 1&lt;/label&gt;
  
  &lt;input class="required" id="Example32" name="Example3" type="checkbox" /&gt;
  &lt;label for="Example32" class="error"&gt;Example Input 3 Option 2&lt;/label&gt;
  
  &lt;input class="required" id="Example4" name="Example4" type="radio" /&gt;
  &lt;label for="Example4" class="error"&gt;Example Input 4&lt;/label&gt;
  </code></pre>
  
  <p>To add the errors, I figure out if the any checkbox with the same name is checked, using this script:</p>
  
  <pre><code>$("input.required").each(function() {
      // check checkboxes and radio buttons
          if ($(this).is(":checkbox") || $(this).is(":radio")) {
              var inputName = $(this).attr("name");
              if (!$("input[name=" + inputName + "]").is(":checked")) {
                  var inputId = $(this).attr("id");
                  $("label[for=" + inputId + "]").addClass("error");
                  error = true;
              };
          };
      // end checkboxes and radio buttons
  });
  </code></pre>
  
  <p>How can I remove the errors without having to modify the HTML? I'm drawing a complete blank. Here's what I'm thinking:</p>
  
  <ol>
  <li>Figure out the name associated with each label that has an error</li>
  <li>Find the checkbox or radio button that has that ID</li>
  <li>Figure out the checkbox or radio buttons name</li>
  <li>Find the rest of the checkboxes or radio buttons with the same name</li>
  <li>Find those inputs IDs</li>
  <li>Find labels with those names</li>
  <li>Clear the errors off of those labels</li>
  </ol>
  
  <p>I'm a t loss, though. If anyone  can help, that'd be greatly appreciated.</p>