jQuery :not() SelectorThe :not() selector selects all elements except the specified element. This is mostly used together with another selector to select everything except the specified element in a group (like in the example above).
In jQuery, you can select multiple elements by separate it with a comma “,” symbol.
Trying to assemble a rather complex jQuery selector here, and having trouble.
Essentially, I'm trying to grab all anchors that that 1) do not have a "rel" of "facebox", and OR 2) do not have an "href" that begins with "mailto".
This is what I've been trying to do:
$('a[rel!=facebox], a[href!^="mailto"]')
Small variations of this don't seem to work. Is there some better way of going about this?
These selectors seem to work individually, but not when sitting consecutively in the same selector:
$('a:not([rel=facebox]), a:not([href^=mailto])')
Final solution: We have a winner!
$('a:not([rel=facebox],[href^=mailto])')
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