jQuery Checkbox selection and change class
<p>I have a form like this:</p>

<pre><code>&lt;form action='' onsubmit='void(0)' class="mainform"&gt;
                &lt;label class="form3"&gt;&lt;input type="checkbox"&gt; One a fancy cross-browser styled checkbox&lt;/label&gt;
                &lt;label class="form3"&gt;&lt;input type="checkbox"&gt; two a fancy cross-browser styled checkbox&lt;/label&gt;
                &lt;label class="form3"&gt;&lt;input type="checkbox"&gt; Three a fancy cross-browser styled checkbox&lt;/label&gt;
                &lt;label class="form3"&gt;&lt;input type="checkbox"&gt; Four a fancy cross-browser styled checkbox&lt;/label&gt;
                &lt;label class="form3"&gt;&lt;input type="checkbox"&gt; Five a fancy cross-browser styled checkbox&lt;/label&gt;
                &lt;label class="form3"&gt;&lt;input type="checkbox"&gt; Six a fancy cross-browser styled checkbox&lt;/label&gt;
                &lt;label class="form3"&gt;&lt;input type="checkbox"&gt; Seven a fancy cross-browser styled checkbox&lt;/label&gt;
                &lt;label class="form3"&gt;&lt;input type="checkbox"&gt; eight a fancy cross-browser styled checkbox&lt;/label&gt;
                &lt;label class="form3"&gt;&lt;input type="checkbox"&gt; 9 a fancy cross-browser styled checkbox&lt;/label&gt;
                &lt;label class="form3"&gt;&lt;input type="checkbox"&gt; 10 a fancy cross-browser styled checkbox&lt;/label&gt;
                &lt;label class="form3"&gt;&lt;input type="checkbox"&gt; 11 a fancy cross-browser styled checkbox&lt;/label&gt;
                &lt;label class="form3"&gt;&lt;input type="checkbox"&gt; 12 a fancy cross-browser styled checkbox&lt;/label&gt;
                &lt;label class="form3"&gt;&lt;input type="checkbox"&gt; 13 a fancy cross-browser styled checkbox&lt;/label&gt;
                &lt;label class="form3"&gt;&lt;input type="checkbox"&gt; 14 a fancy cross-browser styled checkbox&lt;/label&gt;
&lt;/form&gt;
</code></pre>

<p>Now, I want to do this.
When the user checks or unchecks a checkbox, I want to add/remove class to the label so that I can show different coloured text when teh checkbox is selected and when it is not.</p>

<p>I am trying to do it liek this:</p>

<pre><code>$(document).ready(function(){
$('.form3').each(function(i,e) {
   if(checklist[i] == "")
    {
        $(this).find('input[type=checkbox]').attr('checked', false);
        $(this).appendTo($('form'));
        $(this).find('input[type=checkbox]').change(function() {
            $(this).closest('label').addClass("checkselected");
        });
        $(this).closest('label').removeClass("checkselected");

    }
    else
    {
        $(this).find('input[type=checkbox]').attr('checked', true);
        $(this).find('input[type=checkbox]').change(function() {
            $(this).closest('label').removeClass("checkselected");
        });
        $(this).closest('label').addClass("checkselected");
    }
});
});
</code></pre>

<p>Now I know that this maynot be the right way to do it because I am doing this inside the "$('.form3').each(function(i,e)"</p>

<p>This makes it work but only once.
How can I make it work even with mulltiple clicks to the same checkbox.</p>
