use classList in if statement code example Example: if classlist contains js element.classList.contains(class);