know if this element has class vanilla js code example
Example 1: js check for class in classList
element.classList.contains(className);
Example 2: javascript hass class
if (myElement.classList.contains('someClassname')) {
// do something
}
element.classList.contains(className);
if (myElement.classList.contains('someClassname')) {
// do something
}