tags:

views:

42

answers:

2
<ul id ='caseStudies'>
<li class="humor crime fantasy hidden"> A </li>
<li class="crime"> B </li>
<li class="humor crime hidden"> C </li>
<li class="humor crime"> D </li>
<li class="humor crime fantasy action hidden"> E </li>
<li class="fantasy action"> F </li>
<li class="humor fantasy"> G </li>
<li class="crime action hidden"> H </li>
</ul>



$('ul#caseStudies li.hidden').each(function() {

}//this will get all the LI in the UL that has got class 'hidden'

But how do i get all the LI in the UL that hasn got a class 'hidden'?

+2  A: 

try the :not() selector

$('ul#caseStudies li:not(.hidden)').each(function() { 

}
Andy E
@Andy is there any way of getting the count of those items?i want to use that in the each()
manraj82
Updated my answer.
rahul
@manraj82: set `var visibleCS = $('ul#caseStudies li:not(.hidden)');` then use `visibleCS.length` to get the total number of items found by the query.
Andy E
+3  A: 
rahul
lol beat you by 2 seconds ;-)
Andy E
+1 for that @Andy.
rahul
@rahul: and +1 for you too.
Andy E
@rahul sorry m8 i had to give point 4 the correct answer to Andy here since he answered the question earlier....:)
manraj82
but i hav given u +1...
manraj82
No probs. Since Andy was the first to answer you have to mark his one as the accepted answer.
rahul
answer Wars WOOO HOOO!
Mark Schultheiss