How can I check in JavaScript if a DOM element contains a class?
I tried the following code, but for some reason it doesn\'t work...
if (document.get
If you are using jQuery then just this simple code will help:
if ($('.yourclass').length) { // do something }
If you like to check more than 2 classes in the page then use $('.yourclass').length > 2
$('.yourclass').length > 2