title: jQuery count checkboxes in divs with display: block but not display: none
body: <p>I want to use jquery to count the number of checkboxes in a div but only when the div display is set to block, and not when it's set to none.  This changes based on button presses.</p>
  
  <p>I've tried this so far:</p>
  
  <pre><code>$("div:#divid:visible").find('input:checkbox').length
  $('input:checkbox:visible').length
  $("div:#divid").find('input:checkbox.visible').length
  </code></pre>
  
  <p>What always seems to happen is, if include 'visible' then it always counts 0 checkboxes no matter whether their parent div is display:none or block, and if I don't include 'visible' it always counts all of the checkboxes, again ignoring the display status of the parent div.  The checkboxes themselves to not have a display property.  </p>