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


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'});

solved If a element hasClass then display:none;