title: How to create script that counts divs not hidden and updates as user applies filter
body: <p>I am having trouble creating script to count/display the number of divs that the user has selected to display compared to the total amount of divs available.</p>
  
  <p>Here is a JSFiddle showing the entire problem. <a href="http://jsfiddle.net/rcmb06om/" rel="nofollow">http://jsfiddle.net/rcmb06om/</a></p>
  
  <p>Here is the script i'm using to count both the total number of divs with a class and then trying to count the total number of divs with a class:visible.</p>
  
  <pre><code>$( document.body ).append( $( "&lt;div&gt;" ) );
  var n = $(".rResult").length;
  $( "#totalresults" ).text( n);
  
  $( document.body ).append( $( "&lt;div&gt;" ) );
  var x = $(".rResult").filter(":visible").length;
   $( "#activeresults" ).text( x);
  </code></pre>