How do I count list elements that are not hidden?
- by Baloneysammitch
Starting with a simple list:
<ul>
<li>Item 1</li>
<li style="display: none;">Item 2</li>
<li>Item 3</li>
</ul>
I know that I can subtract the hidden elements from the list total
$('ul li').size() - $('ul li:hidden').size()
But I thought there might be a more elegant way to achieve this with jquery:
$('ul li:hidden:not').size()
That doesn't work. Any ideas?