check if an element has a classname js code example Example: js check for class in classList element.classList.contains(className);