There is a ticket raised for this - http://dev.jquery.com/ticket/1854 - as a result of a discussion on the jQuery development list. It would seem there is some doubt about whether or not it is actually a bug, since this restriction (or feature) was (allegedly!) a conscious decision taken during implementation of the not() functionality (method and filter). [but shsh! ... keep it quiet, because very few people know yet!]
Meantime, what you have to do is change your code to call filter(), with a function as its argument, which returns the inverse of a test for what you want to exclude (?!) ... eg $('form :input').filter( function(){ return !$ (this).is(':hidden[name=a]'); } ); Neat, huh? On Oct 31, 7:16 pm, Pete Kruckenberg <[EMAIL PROTECTED]> wrote: > I've come across some behavior of not() that doesn't match the docs, > or I'm not understanding the docs. > > Given the following form: > > <form> > <input type=hidden name=a> > <input type=hidden name=b> > </form> > > I'd expect "$('form :input:not(:hidden[name=a])')" to return "[<input > type=hidden name=b>]", > since "$('form :hidden[name=a]')" returns "[<input type=hidden > name=a>]" and > and not(selector) should "Filters out all elements matching the given > selector". > > However, "$('form :input:not(:hidden[name=a])')" instead returns > "[ ]" (empty array), acting more like > "$('form :input:not(:hidden):not([name=a])')" or "$ > ('form :input:not(:hidden,[name=a])')" (i.e. "or"ing the selector > parameters instead of "and"ing them). > > "$('form :input').not(':hidden[name=a])')" produces the same results > (empty array). I'd expect it to be the inverse of "$ > ('form :input').filter(':hidden[name=a])')" (which returns "[<input > type=hidden name=a>]". > > Am I misunderstanding the docs, or is this a bug with not()? > > I get the same results in both 1.2.1 and 1.1.4. Tested on FF2.0.0.8/ > Win. > > Thanks. > Pete.