Opposite .find ()

Is there an opposite of .find ()?

Where $('.myclass').except('#myid');

Will capture all elements with .myclass, except for the C # myid element. I know what I could do in this example $('.myclass[id=myid]'), but it seems like it would be useful in other cases.

thank

EDIT:

Thanks for answers! Looks like I just missed viewing .not()and :not()documentation.

+3
source share
8 answers
$('.myclass').not('#myid');

http://api.jquery.com/not/

+10
source

Try it .not()- it removes any element matching the selector.

+4
source

$('.myclass').not('#myid')

+3

, :

$('.myClass:not(#myid)')

:not() .not().

, , ( ) , .

, .not(), , , .myclass, , .

+3

$('selector:not(selector)').doStuff()

$('.myclass:not(#myid)').doStuff() 

, .

http://api.jquery.com/not-selector/

.

+1
+1

, . jQuery :not .not(). :

$('.something').not('.else')
$('.something:not(.not-me):not(.neither-me)')

, CSS3 :not .

0

. Find, , , Find() , , . Find .Not(: has (...)).

0

Source: https://habr.com/ru/post/1742891/


All Articles