Reputation: 7135
How best would I exclude results from #other_section, given a structure like this?
<form>
<input id=one>
<div id=other_section>
<input id=two>
</div>
</form>
Here's a possible API:
inputs = @find(":input").exclude("#other_section :input")
Upvotes: 0
Views: 677
Reputation: 509
$(':input:not(#other_section > :input)');
example: http://jsfiddle.net/5XCcF/
Upvotes: 2
Reputation: 7135
Here's my solution:
$.fn.exclude = (selector)->
excluded_items = @end().find(selector)
@filter ->
!_.include(excluded_items, this)
Upvotes: 0