[jQuery] Re: Counting Lists inside of Lists

2009-02-19 Thread Tim
This worked. Thank you! On Feb 19, 5:27 pm, James wrote: > Try: > $('li', this).length; > > On Feb 19, 3:14 pm, Tim wrote: > > > So I have a main list of states in an unordered list and then a > > unordered list of cities within each of those. So I wanted to count > > the number of cities per s

[jQuery] Re: Counting Lists inside of Lists

2009-02-19 Thread ricardobeat
$(this+ '> li') 'this' is an HTML Element (each LI) and you're trying to concatenate it with a string. That should be $(this).find('li').length or $('li', this).length Note that the list items are not direct children of "this" (the parent LI), so don't use the '>'. cheers, - ricardo On Feb 19,

[jQuery] Re: Counting Lists inside of Lists

2009-02-19 Thread James
Try: $('li', this).length; On Feb 19, 3:14 pm, Tim wrote: > So I have a main list of states in an unordered list and then a > unordered list of cities within each of those. So I wanted to count > the number of cities per state. > > >         Alabama >         >             http://www.google.