“All but not” jQuery selector

Simple:

$('div').not('#myid');

Using .not() will remove elements matched by the selector given to it from the set returned by $('div').

You can also use the :not() selector:

$('div:not(#myid)');

Both selectors do the same thing, however :not() is faster, presumably because jQuery’s selector engine Sizzle can optimise it into a native .querySelectorAll() call.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)