+ 4
Why can't I add a class attribute using Javascript [PLEASE HELP]?đ©đ©đ©đ©
Am trying to add class attributes to elements I have created using JS but it is not working. It only works when I add an id but I need to use multiple classes for an element so that I can style the elements using CSS according to their groups.
1 Answer
+ 4
document.className = "name"
Or
document.classList.add("name")