jQuery Script Adding Class to Every Radio Button and Checkbox Label
<p>Why does this script add a class to every radio button and checkbox Label on the page, instead of just the ones for each individual checkbox/radio button?</p>

<p>For example, I have these buttons:</p>

<pre><code>&lt;input class="required" id="Example31" name="Example3" type="checkbox" /&gt;
&lt;label for="Example31"&gt;Example Input 3 Option 1&lt;/label&gt;

&lt;input class="required" id="Example32" name="Example3" type="checkbox" /&gt;
&lt;label for="Example32"&gt;Example Input 3 Option 2&lt;/label&gt;

&lt;input class="required" id="Example4" name="Example4" type="radio" /&gt;
&lt;label for="Example4"&gt;Example Input 4&lt;/label&gt;
</code></pre>

<p>And this script:</p>

<pre><code>$("input.required").each(function() {
    if ($(this + ":checkbox") || $(this + ":radio")) {
        if (!$(this + ":checked").val()) {
            var inputId = $(this).attr("id");
            $("label[for=" + inputId + "]").addClass("error");
        };
    };
});
</code></pre>

<p>The script fires when I click a button. If no box is checked, every label gets an error added to it, which is correct. However, if one box is checked, no label gets an error on it, which is incorrect. If I check a checkbox in the first group, but leave the radio button unchecked, that radio button should be marked as an error.</p>

<p>NOTE: I know this script doesn't account form the input names just yet (so if one checkbox with the same name is checked, the other would currently display an error), I'm trying to get his bug worked out before moving forward.</p>
