Answers for "js css class"

-1

js css class

// To add a class to an element:
const element = document.getElementById("myDIV");
element.classList.add("myClass");
// To get all classes of an element:
const element = document.getElementById("myDIV");
let classList = element.classList;
Posted by: Guest on April-07-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language