javaScript проверяет, есть ли у элемента класс
if(document.getElementById("myElmentID").classList.contains("hidden")){
// I have the 'hidden' class
}
Grepper
if(document.getElementById("myElmentID").classList.contains("hidden")){
// I have the 'hidden' class
}
document.body.onclick = function(e) {
var clickedEl = window.event ? event.srcElement : e.target;
while (clickedEl != null) {
if (clickedEl.className
&& (" " + clickedEl.className + " ").indexOf(" yourclass ") != -1) {
// do something, e.g.,
alert("Element with class was clicked");
return;
}
clickedEl = clickedEl.parentNode;
}
}