I'm not sure but I think that .not(obj) is currently implemented to
exclude singular DOM elements, meaning arrays of elements and jQuery
element sets wouldn't do anything. That could maybe be an API change for
jQuery 1.1?
-blair
Oliver Boermans wrote:
> Hi all
>
> It would be useful to be able subtract a list of elements generated
> from a compound selector - from the results of another.
>
> I thought I might be able to do this using what is documented as
> $(obj) within a .not() but isn't working for me. Perhaps there is a
> good reason it's failing?
>
> Here's a silly simplistic example, where I want to select the
> paragraphs that are not bold and don't have a class of 'odd':
>
> var evenweak = $("p").not(".odd").not("[b]");
>
> // This works but I want the opposite
> $( evenweak ).css("color","red");
>
> // These don't work (the not is ignored)
> $("p").not( $( evenweak ) ).css("color","red");
> $("p").not( $( evenweak ).get() ).css("color","red");
>
> With this HTML:
> <p class="odd"><b>one</b></p>
> <p><b>two</b></p>
> <p class="odd">three</p>
> <p>four</p>
>
> Before you suggest one of the many easier ways to do this - I know
> this example is less than sensible with this example HTML. My real
> problem is more complex - just want to kill off this direction before
> I try another.
>
> Any insights?
> Cheers
> Ollie
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/