You can use comments.className.split(/\s+/);
and then iterate over the options to find what you want
var classes = comments.className.split(/\s+/);
var classexists = false;
for(i=0; i<classes.length; i++){
if(classes[i] === "specifiedclass"){
classexists = true;
break;
}
if(classexists){...
Doing this as a function
function hasClass(desiredClass,el){
var classes = el.className.split(/\s+/);
var classexists = false;
for(i=0; i<classes.length; i++){
if(classes[i] === desiredClass){
classexists = true;
break;
}
}
return classexists;
}
if(hasClass("specifiedclass",comments){...
(thanks to the system
for the suggestion)