RwL wrote:
You don't need to wrap the parameter to not in $(...). Maybe try:

$("a").not("#nav a").click(function() { alert('...'); return false; });

You know, that's what I thought too, but the "not" selection didn't
work at all until I wrapped my NOT selection with $() -- that is, #nav
a was still getting the alert onclick.

And the too much recursion error appears regardless of whether it's
not("#nav a") or not($("#nav a")).

Strange, right?

If you use not() with an expression, it will only work with so called simple selectors.

"A simple selector is either a type selector or universal selector followed immediately by zero or more attribute selectors, ID selectors, or pseudo-classes, in any order. The simple selector matches if all of its components match."

http://www.w3.org/TR/CSS21/selector.html#selector-syntax
http://docs.jquery.com/DOM/Traversing#not.28_expr_.29


Regarding using a set of elements to exclude I found this in the docs:

"Please note: the expression cannot use a reference to the element name. "
http://docs.jquery.com/DOM/Traversing#not.28_elems_.29


That said, $("a").not( $("#nav a") ) is not supposed to work if I understood that correctly. Also see the example in the link.

The following would, given all the links in #nav belong to a class of "nav"

$("a").not("#nav a.nav")

Let's not add classes only for that purpose. Maybe you can also try to workaround this limitation by selecting not by type but href attribute which is only allowed for links:

$("a").not("#nav [EMAIL PROTECTED]")


HTH


--Klaus


Reply via email to