[Solved] If a element hasClass then display:none;

[ad_1]

You could also use the :not() selector based on the OP’s original premise –

(I’m assuming that ‘cool’ and ‘hot’ are classes in this example)

$('.cool:not(.hot)').css({'display':'none'});

You could also use the .not() method –

$('.cool').not('.hot').css({'display':'none'});

[ad_2]

solved If a element hasClass then display:none;