Devi utilizzare il metodo hasClass() che appunto ti restituisce true se il tuo elemento ha quella classe http://api.jquery.com/hasClass/