Glen's suggestions should work.
For classes, the best way is probably to use the class selector,
along with "not" (either as a method or a pseudo-class). So in
addition to Glen's examples, you could do this:
$('p:not(.myclass)')
For other attributes, you can do something like this, too:
$('[EMAIL PROTECTED]')
The problem with that one, though, is that it selects all elements
that don't have the exact rel value "foo". So, it would select an "a"
with rel="foo bar". You might want to select the "a" only if it
doesn't have "foo" anywhere in the rel attribute, though. To do this,
you'd have to combine :not with [EMAIL PROTECTED], like so:
$('a:not([EMAIL PROTECTED])')
Your last example is taken care of easily with this:
$(':not([EMAIL PROTECTED])')
Of course, it's a good idea to put a tag name in front of pseudo-
classes such as ":not"
--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On May 27, 2007, at 7:01 PM, Glen Lipka wrote:
How about:
$("p").not("#selected")
or
$("input").not("[EMAIL PROTECTED]" + somevariable + "]")
You also have filter() and some other ways of finding it.
Glen
On 5/27/07, Adrian Gheorghe <[EMAIL PROTECTED]> wrote:
Hello everyone,
In a project, a few weeks ago, I needed support for something like
@attr!="val", that is selecting all attributes which don't have a
certain value (for example selecting all divs which don't have a
certain class). I was wondering if support for something like this is
planned, if it's a good ideea or somebody else needed this (of course,
I think other operators could be negated as well, like @attr!^="val").
Adrian.