With the risk of being redirected to a dublicate question, what is the difference between using $("ul li") and $("ul").find("li")?
Asked
Active
Viewed 44 times
2 Answers
1
You may find this similar question of interest: What is the fastest method for selecting descendant elements in jQuery?
If you only need first level children, using .children() will give you a performance boost since there is less to interrogate.
Community
- 1
- 1
Justin Helgerson
- 24,900
- 17
- 97
- 124
-
Excellent article - that's exactly what I needed! – Stig Perez Feb 09 '12 at 21:02
0
$("ul").find("li") is faster than $("ul li").
$("ul li") is going to be changed into $("ul").find("li") after some checks and breaking.
find() appeared faster than children() to me in single level selections.
Jashwant
- 28,410
- 16
- 70
- 105