jQuery show total li item using loop
<p>Basically i wanna show total list items for each list item that contains sub ul, see my code: <a href="http://jsfiddle.net/NykJe/" rel="nofollow">http://jsfiddle.net/NykJe/</a></p>

<pre><code>&lt;ul&gt;
    &lt;li&gt;linkA&lt;/li&gt;
    &lt;li&gt;linkB&lt;span class="total"&gt;&lt;/span&gt;
        &lt;ul&gt;
            &lt;li&gt;link2&lt;/li&gt;
            &lt;li&gt;link2&lt;/li&gt;
            &lt;li&gt;link2&lt;/li&gt;
        &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;linkC&lt;/li&gt;
    &lt;li&gt;linkD&lt;span class="total"&gt;&lt;/span&gt;
        &lt;ul&gt;
            &lt;li&gt;link2&lt;/li&gt;
            &lt;li&gt;link2&lt;/li&gt;
            &lt;li&gt;link2&lt;/li&gt;
            &lt;li&gt;link2&lt;/li&gt;
            &lt;li&gt;link2&lt;/li&gt;
        &lt;/ul&gt;
    &lt;/li&gt;
&lt;/ul&gt;

var total = $('ul li ul li').size();
$('.total').append('&lt;div&gt;'+ total +'&lt;/div&gt;');
</code></pre>

<p>i wanna use loop that count each specific sub ul li items count and result will be LinkB 3 and LinkD 5 currently it shows LinkB 8, LinkD 8</p>
