Search results

So we can operate both on the full class string using className or on individual classes using classList… Methods of classList: elem.classList.add/remove("class") – adds/removes the class. elem.classList.toggle… Besides, classList is iterable, so we can list all classes with for..of, like this:… are two DOM properties: className – the string value, good to manage the whole set of classes. classList