jquery selecting children not nested in a child

rridge

New Member
I have some problems with a jQuery selector.Let's say I have the following html where \[code\](...)\[/code\] stands for an undefined number of html tags.\[code\](...)<div class="container"> (...) <div class="subContainer"> (...) <div class="container"> (...) <div class="subContainer"/> (...) </div> (...) </div> (...)</div>(...)\[/code\]Let say that I have a javascript variable called \[code\]container\[/code\] that points to the first div (with class container).I want a jquery that selects the first subcontainer but not the nested one.If I use\[code\]$(".subContainer", container);\[/code\] I'll get both of them.I've tried using\[code\]$(".subContainer:not(.container .subContainer)", container);\[/code\]but this returns an empty set.Any solution?Thanks.
 
Back
Top