I have two sets of unordered lists with the same class name and I want to subset it with jquery slice.
var currentCount= 0;
var maxCount= 3;
$('.ulClassName>li').slice(currentCount,maxCount).show();
This works perfectly for the first UL (it shows only the first three lists) but does not slice the second UL with the same class name. Below is the markup:
<ul class="ulClassName" id="firstUL">
<li>Blah blah1 </li>
<li>Blah blah2 </li>
<li>Blah blah3 </li>
<li>Blah blah4 </li>
<li>Blah blah5 </li>
<li>Blah blah6 </li>
</ul>
<ul class="ulClassName" id="secondUL">
<li>Blah blah1 </li>
<li>Blah blah2 </li>
<li>Blah blah3 </li>
<li>Blah blah4 </li>
I understand that jquery indexes all list elements in the page, I dont want to write separate code for the two lists, can somebody help me?
You might want to call: