get all LI within UL
<p>I am trying to find all <code>li</code> within <code>ul</code></p>

<p>if I do </p>

<pre><code>console.log(element);
</code></pre>

<p>I get the ul element output in firebug.</p>

<p>If I <code>console.log(element[0]);</code> I get undefined.</p>

<p>Now to try to find all <code>li</code> within <code>ul</code> I do:</p>

<pre><code> $('li', element).each(function (index) {
            console.log(index);
});
</code></pre>

<p>But my index never gets outputed.</p>

<p>If I do:</p>

<pre><code>$('li', element[0]).each(function (index) {
            console.log(index);
            $(this).data('previousIndex', index);
        });
</code></pre>

<p>I get too many index count outputed to my console. My ul only has 3-4 <code>li</code> but I get some false count outputed.</p>

<p>Can anybody tell me my mistake?</p>

<p><strong>EDIT:</strong></p>

<p>To give more idea I am using sortable plugin. This is my firebug output when I do a <code>children()</code>. I am not sure why is this happening.</p>

<p><img src="http://i.stack.imgur.com/dBenA.png" alt="enter image description here"></p>
