I have some problems with jQuery selector.
Let's say I have the following html, where (...) denotes the number of html undefined tags.
(...) <div class="container"> (...) <div class="subContainer"> (...) <div class="container"> (...) <div class="subContainer"/> (...) </div> (...) </div> (...) </div> (...)
Let's say that I have a javascript variable called container that points to the first div (with the class container). I want a jquery that selects the first subcontainer, but not nested. If I use $(".subContainer", container); I will get both of them.
I tried using
$(".subContainer:not(.container .subContainer)", container);
but this returns an empty set. Any solution?
Thanks.
javascript jquery html jquery-selectors
Mateu
source share