Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
50
rated 0 times [  52] [ 2]  / answers: 1 / hits: 16204  / 14 Years ago, sat, may 15, 2010, 12:00:00

If I have a selector like



$.('.active');


How can I see how many items that matched?



Alternatively, is there an easy way to see if more than zero elements were matched?


More From » jquery

 Answers
33

call .length on the returned set.



Do not use .size because:




The .size() method is deprecated as of jQuery 1.8



[#96781] Wednesday, May 12, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
teagan

Total Points: 98
Total Questions: 106
Total Answers: 101

Location: Tajikistan
Member since Thu, Apr 14, 2022
2 Years ago
;