title: jQuery count div that has display:block
body: <p>I have div elements as shown in image below. I want count of divs that has css display as block.</p>
  
  <p>What I tried:</p>
  
  <p>1)    <code>$('div.price_listing_container:visible').length</code></p>
  
  <p>and </p>
  
  <p>2.)</p>
  
  <pre><code>  $('#content').children("div").filter(function() {
          return $(this).css('display') !== 'none';
    }).length
  </code></pre>
  
  <p>and </p>
  
  <p>3.)    <code>$("#content &gt; div").filter(":block").size()</code></p>
  
  <p>Last option didn't worked at all, other two work in alert but if I assign their returned value to a variable the value comes 0, not sure why is it so, See the code below:</p>
  
  <pre><code>var numberOfResultsVisible =  ($('#content').children("div").filter(function() {
                  return $(this).css('display') !== 'none';
              }).length);
  </code></pre>
  
  <p>and </p>
  
  <pre><code>var numberOfResultsVisible =  $('div.price_listing_container:visible').length;
  </code></pre>
  
  <p>After assignment value comes 0.</p>
  
  <p>Can you please tell if I can use some other method to get the count.</p>
  
  <p><img src="https://i.stack.imgur.com/L5HII.png" alt="enter image description here"></p>