I want to filter multiple values from an event in jQuery.
At the moment I have:
.filter(":not(.element)")
How would I go about adding more things to filter? I've tried:
.filter(":not(.element, .another, .etc)")
and
.filter(":not(.element)").filter(":not(.another)").filter(":not(.etc)")
and
.filter(":not(.element),:not(.another),:not(.etc)")
With no luck. What do I need to do?
Thanks.
EDIT: Thanks for the answers - I've find another solution to my problem that avoids having to do what I've asked in the question, but evidently I wasn't doing something properly in my code since the solutions posted work. I will mark an answer as correct, many thanks.
It is working, you just need to separate each element using a comma (,) in the :not()
selector.
You can check the example here: http://jsfiddle.net/LVUMs/
Looks like it is working. http://jsbin.com/uyayot/edit#javascript,html
I tried:
$('div').not('#div2,#div4').each ( function () {
alert ( $(this).attr ('id' ) );
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With