JQuery selector for first hierarchy element?
- by Sebastian P.R. Gingter
I have this HTML structure:
<div class="start">
<div class="someclass">
<div class="catchme">
<div="nested">
<div class="catchme"> <!-- STOP! no, no catchme's within other catchme's -->
</div>
</div>
</div>
<div class="someclass">
<div class="catchme">
</div>
</div>
</div>
<div class="otherclass">
<div class="catchme">
</div>
</div>
</div>
I am looking for a JQuery structure that returns all catchme's within my 'start' container, except all catchme's that are contained in a found catchme. In fact I only want all 'first-level' catchme's regardless how deep they are in the DOM tree.
This is something near, but not really fine:
var start = $('.start');
// do smething
$('.catchme:first, .catchme:first:parent + .catchme', start)
I sort of want to break further traversing down the tree behind all found elements. Any ideas?