The JQuery has method effectively selects all elements where they have particular descendants.
I want to select elements based on the fact they have particular ancestors. I know about parent([selector]) and parents([selector]) but these select the parents and not the children with the parents.
So is there an ancestor equivalent of has?
Note: I already have the context of an element further down the hierarchy and I will be selecting based on this so I can't do a top down query.
Update
I've obviously explained myself really badly here, so I'll try and clarify:
<ul class=x>
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
<ul class=y>
<li>4</li>
<li>5</li>
<li>6</li>
</ul>
I have a jQuery object that already consists of elements 2,3,4 and 5. I want to select those elements who have a parent with the class = x.
Hope that makes more sense.