Reputation: 26212
I've got a custom jquery selector called deletable
With this selector I get all divs that I need to get. But I have some of these divs containing elements that I don't want so I want to exclude them.
Example :
:deletable returns 3 divs, two of those divs have input elements. I want to get the one without input elements
I tried this (and many other variants):
$(':deletable:not(:deletable:contains(input))')
Not working, I still get all three divs.
I'm using this inside .on()
function like this :
$(document).on('click', ':deletable:not(:deletable:contains(input))' ...)
So I don't know how to use .filter()
function with on (that might be the key).
How do I use :not
properly in my case
Upvotes: 0
Views: 48
Reputation: 17161
$(':deletable').not($(':deletable:has(input)'));
[Illustrative] DEMO: http://jsfiddle.net/A3yGQ/
Upvotes: 2