I need to select elements of a certain class except children of $(this). The trick is no elements have an id attribute and the classes of parent and children elements are the same, so
<div class="onedoc">1
<div class="onedoc">1.1
<div class="onedoc">1.1.1</div>
</div>
<div class="onedoc">1.2</div>
</div>
<div class="onedoc">2</div>
<div class="onedoc">3</div>
in this example, if $(this) is 1 (the first element), I need to select elements containing 1.1.1, 2 and 3
Something like this should work:
DEMO