if (myElement.classList.contains('someClassname')) { // do something }
element.classList.contains('class');
element.classList.contains(className);Code language: CSS (css)