The name is a bit confusing, but here is what I need:
I have a set of elements containing all the elements h3on the page.
In jQuery terms: var mySet = $('h3').
I also have a div element var myContainer = $('div#foo')
I need to find all the elements in the set mySetthat are children of the element myContainer.
Any ideas? I am sure that there is a magic liner for this, but I can’t think of anything. I would prefer not to iterate over each element in the set manually and use .closest(myContainer)or something similar to determine the relationship.
Please note that in my scenario I cannot use a new type selector $('div#foo h3')(that would be too simple), since I do not have access to the actual values of the selector. Therefore, it must be dynamic.
source
share