1479 posts The right tools with none of the gimmicks
    Has referred 50+ members Has sold $75,000+ on Envato Market and is now an Elite Author Has been a beta tester for an Envato feature Has collected 10+ items on Envato Market
+6 more
PixelBin says

Is there a jQuery function that counts how many elements are in a certain element? For example, I want to count how many <li /> tags are in a certain <ul /> list.

Thanks fellas.

1479 posts The right tools with none of the gimmicks
    Has referred 50+ members Has sold $75,000+ on Envato Market and is now an Elite Author Has been a beta tester for an Envato feature Has collected 10+ items on Envato Market
+6 more
PixelBin says

Ahhh, nevermind. I think I got it. Sorry for the useless thread. :(

382 posts
    Has been part of the Envato Community for over 5 years Has referred 1+ members Has sold $10,000+ on Envato Market Has collected 10+ items on Envato Market
+2 more
blabus says

I believe this would work:

$(”#UL-ID”).length();

and you’d of course replace ‘UL-ID’ with the ID of your unordered list.

1479 posts The right tools with none of the gimmicks
    Has referred 50+ members Has sold $75,000+ on Envato Market and is now an Elite Author Has been a beta tester for an Envato feature Has collected 10+ items on Envato Market
+6 more
PixelBin says

Hmmm… I’m using $(‘name of ul here’).find(‘li’).size() which works and shows the right number but there’s a Javascript error in the process.

Edit: Yeah .length() completely breaks all the scripts. .size() at least showed the right number until I pressed something.

94 posts
    Has been part of the Envato Community for over 6 years Has referred 10+ members Has sold $5,000+ on Envato Market Has collected 1+ items on Envato Market
+4 more
JimmyP says

You can use ”.length” or ”.size()” ... not ”.length()”

426 posts
    Has been part of the Envato Community for over 5 years Has referred 10+ members Has sold $5,000+ on Envato Market Has been a beta tester for an Envato feature
+3 more
vasilios says

Just out of shear curiosity, has anyone done any speed tests between ”.length” and ”.size()”?

by
by
by
by
by
by