[jQuery] non-recursive element filtering
hi,
i have been trying to do something simple for the last couple of hours
and i
just can't seem to solve this problem:
maybe easier to give a dom tree first:
...
<div class="list">
<div class="item"> A
<div class="list" style="margin-left:10px;">
<div class="item">1 <button>+</button></div>
<div class="item">2 <button>+</button></div>
<div class="item">3 <button>+</button></div>
</div>
<button>+</button>
</div>
<div class="item"> B
<div class="list" style="margin-left:10px;">
<div class="item">1 <button>+</button></div>
<div class="item">2 <button>+</button></div>
<div class="item">
3
<div class="list" style="margin-left:10px;">
<div class="item">3.1 <button>+</button></div>
<div class="item">3.2 <button>+</button></div>
<div class="item">3.3 <button>+</button></div>
</div>
<button>+</button>
</div>
</div>
<button>+</button>
</div>
</div>
...
given the outer DIV.list element, how can i find all BUTTON elements,
except
for the ones that are in sub DIV.list's?
i would have thought something like $
(myouterdiv).find('button:not('.list
button)') would have worked, but apparently not...
$(myouterdiv).find('button').not('.list button') gives the same
results
i have tried plenty of other selectors, but nothing works...
any idea what could be wrong with that at all?
It just gives me all the BUTTON elements... if anything, i would have
expected it to give me zero since myouterdiv also has the .list class
cheers,
dominique