How to query div with jquery
of class ac
but inside a
not ab
?
If i query $('.a .ac')
it finds ac
but inside ab
<div class="a">
<div class="ab">
<div> class="ac"></div>
</div>
<div> class="ac"></div>
</div>
How to query div with jquery
of class ac
but inside a
not ab
?
If i query $('.a .ac')
it finds ac
but inside ab
<div class="a">
<div class="ab">
<div> class="ac"></div>
</div>
<div> class="ac"></div>
</div>
2
Answers
You can use a child-combinator
>
:You can select an immediate child element with the child combinator, for example: