JS Проверка на занятия в классе
element.classList.contains(className);
Sticky Pingu
element.classList.contains(className);
if (document.body.classList.contains('thatClass')) {
// do some stuff
}
element.classList.contains(class);
let span = document.querySelector("span");
let classes = span.classList;
let result = classes.contains("d");
if (result) {
span.textContent = "The classList contains 'c'";
} else {
span.textContent = "The classList does not contain 'c'";
}