jquery auto-check checkbox from same table
<p>I have this code:</p>

<p><strong>HTML</strong></p>

<pre><code>&lt;table class=tbl&gt;
    &lt;tr&gt;
        &lt;td&gt;
            &lt;input class='c1' type='checkbox'&gt;
            &lt;label&gt;Ceckbox1&lt;/label&gt;
        &lt;/td&gt;
        &lt;td&gt;
            &lt;input class='c2' type='checkbox'&gt;
            &lt;label&gt;Ceckbox2&lt;/label&gt;
        &lt;/td&gt;
        &lt;td&gt;
            &lt;input class='c2' type='checkbox'&gt;
            &lt;label&gt;Ceckbox2&lt;/label&gt;
        &lt;/td&gt;
        &lt;td&gt;
            &lt;input class='c2' type='checkbox'&gt;
            &lt;label&gt;Ceckbox2&lt;/label&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;
&lt;table class=tbl&gt;
    &lt;tr&gt;
        &lt;td&gt;
            &lt;input class='c1' type='checkbox'&gt;
            &lt;label&gt;Ceckbox1&lt;/label&gt;
        &lt;/td&gt;
        &lt;td&gt;
            &lt;input class='c2' type='checkbox'&gt;
            &lt;label&gt;Ceckbox2&lt;/label&gt;
        &lt;/td&gt;
        &lt;td&gt;
            &lt;input class='c2' type='checkbox'&gt;
            &lt;label&gt;Ceckbox2&lt;/label&gt;
        &lt;/td&gt;
        &lt;td&gt;
            &lt;input class='c2' type='checkbox'&gt;
            &lt;label&gt;Ceckbox2&lt;/label&gt;
        &lt;/td&gt;
     &lt;/tr&gt;
   &lt;/table&gt;
</code></pre>

<p><strong>JavaScript</strong></p>

<pre><code> $('.c2').click(function () {
     if ($(this).parent().find('.c2').is(':checked')) {
         alert('all are checked');
     } else {
         alert('none are checked');
     }
 });
</code></pre>

<p>I am trying, with no result, to use jquery to auto-check 'c1' only when all the 'c2' from the same 'tbl' are checked. The count of 'c2' can vary as can the count of 'tbl'.</p>
