jquery - How to select elements from a set that are children of another element -
The title is a bit confusing but here's what I'm after:
-
P> I have a set of elements with all the
h3
elements in a page.
In jQuery Rules:var mySet = $ ('h3')
. -
> I need to find all the items of
mySet
inmyContainer
.
Any thoughts? I'm sure there is something magical a liner for this but I can not think of anyone. Instead I manually not loop and .closest (myContainer) through each element in the set )
or use something like this to determine the relationship.
Note that in my scenario, I can not use a new selector like $ ('div # foo h3')
(this will be very easy) because I have real Selector values are not accessible. Therefore, it has to be dynamic. Interesting assume that you have two jQuery collections and you do not know the selectors