title: jQuery: how can I select only the checkboxes that are visible and checked?
body: <p>I'm trying to check whether or not all the visible check boxes in a certain series are checked  and i thought of just counting those that are visible and those that are visible and checked to see if the numbers are the same. The problem is I can't get the visible nor the checked selectors to work.</p>
  
  <p>These are some of the ideas I had but didn't work: </p>
  
  <pre><code>if($j("input[id^='chk_camp']:visible:checked").length == $j("input[id^='chk_camp']:visible").length)
  </code></pre>
  
  <p>both sides are 0 in this case</p>
  
  <pre><code>if($j("input[id^='chk_camp']").filter(':visible').filter(':checked').length == $j("input[id^='chk_camp']").filter(':visible').length)
  </code></pre>
  
  <p>also returned 0 on both sides.</p>
  
  <p>Also tried </p>
  
  <pre><code>if($j("input[id^='chk_camp'][visible][checked]").length == $j("input[id^='chk_camp'][visible]").length)
  </code></pre>
  
  <p>and this also returns 0 on both sides.</p>
  
  <p>As a note <code>$j("input[id^='chk_camp']").length</code> returns the correct value. Also the browser I'm working with is Firefox.</p>
  
  <p>What am I doing wrong here?</p>
  
  <p>Answer: Aparently what I'm doing wrong is somewhere else. I was doing these checks before actually making the div containing the checkboxes visible so all the visibility checks were returning false. </p>