To select a child node in jQuery one can use children() but also find().
For example:
$(this).children(\'.foo\');
gives the same result
Those won't necessarily give the same result: find()
will get you any descendant node, whereas children()
will only get you immediate children that match.
At one point, find()
was a lot slower since it had to search for every descendant node that could be a match, and not just immediate children. However, this is no longer true; find()
is much quicker due to using native browser methods.