How to count children from different lists? [jQuery]
- by Filip Breckx
Hi,
I'm trying to count the number of child elements a certain category has.
This is the situation:
<ul id="select_cat">
<li id="_1">Category 1 (<span>#</span>)</li>
<li id="_2">Category 2 (<span>#</span>)</li>
</ul>
<ul id="cat_1>
<li>Link 1</li>
<li>Link 2</li>
<li>Link 3</li>
</ul>
<ul id="cat_2">
<li>Link 1</li>
<li>Link 2</li>
</ul>
So I want to count the number of children a category has.
In this example the first cardinal sign should be 3, and the second should be 2.
How can I do this, using jQuery.
Check an example (not jQuery)
Thanks!