Answers for "js several contains classes"

39

javascript check if element has class

if(document.getElementById("myElmentID").classList.contains("hidden")){
// I have the 'hidden' class
}
Posted by: Guest on August-02-2019
3

classlist

// use the classList API to remove and add classes
div.classList.remove("foo");
div.classList.add("anotherclass");
Posted by: Guest on March-22-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language