jQuery each elements, but only first parents? -


is there way select top parents in div?

my structure:

<div class="topparent">     +<div class="child">         -<div class="child">             -<div class="child"></div>         </div>     </div>      +<div class="child"></div> </div> 

i've added + , - signs indicate i'm trying get. i'm using $('.topparent').find('.child').each(function() { .. } ); iterate, .child elements selected in loop.

is there way select top .child elements, , go through them , count how many other .child elements particular div has?

$('.topparent > .child').each(function() {...}); 

selects direct children !


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -