check/uncheck checkboxs
<p>I am trying to do this for an hour, I tried various of examples but all react the same:</p>

<pre><code>$('body').append('&lt;div id="allchecks"&gt;checkBoxes:&lt;br /&gt;');
$('#allchecks').append('&lt;input id="mcheck" type="checkbox"/&gt;mainCheck&lt;hr /&gt;');

for (var i = 0; i &lt; 9; i++) {
    $('#allchecks').append('&lt;input class="regCheck" type="checkbox" /&gt;regularCheck&lt;br /&gt;');
}
$('#allchecks').append('&lt;/div&gt;');

$('#mcheck').click(function () {
    if ($('#mcheck').is(':checked')) {
        $('.regCheck').attr('checked', 'checked');
    } else {
        $('.regCheck').removeAttr('checked');
    }
});
</code></pre>

<p>The first 2 tries works but after the second try nothing work.
If I look at the source after 2 tries the ' attr('checked', 'checked') ' appears 
and ' removeAttr('checked') ' occur also. </p>

<p>But not visual.</p>

<p>Can someone please explain why is it happening?</p>
