Say I have this HTML:
top
middle
bottom
middle
-
You can use find()
Description: Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element.
$top.find(".middle");
讨论(0)
-
Use
$('.middle', $top)
or
$top.find('.middle')
You could also have simply combined the selectors, which are strings, with
$($top.selector + ' .middle')
but this would only be slower and less readable...
讨论(0)
-
Could you just select it like this:
$('.top .middle').click();
讨论(0)