title: jQuery length function not working correclty in checkbox field
body: <p>I am trying to use jQuery in a checkbox field  to calculate the number of fields that have been checked, but I don't seem to have got the syntax correct. </p>
  
  <p>Below is my attempt to count the number of fields that have been checked (there are over 20 checkbox fields).</p>
  
  <pre><code>$('#product-effect-table input[type=checkbox]').click(function()
    if($('#product-effect-table input[type=checkbox]').length == $('#product-effect-table input[type=checkbox]:checked').length) {
              $("#selectall").attr("checked", "checked");
          }
    else {
              $("#selectall").removeAttr("checked");
          }
  
      });
  </code></pre>
  
  <p>I think that the fault lies in my DOM selection. </p>
  
  <p>The checkboxes are stored in a table with an <strong>id</strong> of <strong>product-effect-table</strong></p>
  
  <p>Below is a sample of the table and an input bar; </p>
  
  <pre><code> &lt;table id="product-effect-table"&gt;
     &lt;td&gt;  &lt;input type="checkbox" name="effect5" id="effect5" value="1" checked="checked"       product_effect_id="5" /&gt;&lt;/td&gt;
  &lt;/table&gt;
  </code></pre>