Answers for "classlist"

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
0

.classList

// .classList method returns an array of the classes attached to the element it is called with.
document.getElementById("myDIV").classList
// It returns
// [ 'className1', 'className2', ... ]
Posted by: Guest on April-26-2020

Browse Popular Code Answers by Language