$('#test').addClass('newColor'); $('#test').removeClass('newColor'); if( $('div').hasClass('.redColor') ) { }