Add class to an element in JavaScript

Posted on: October 3rd, 2022
By: Tadeo Martinez

One thing to note is not add a “.” as you would with querySelector.

element.classList.add("new-class");

Have any questions or comments? Write them below!


Leave a Reply

Your email address will not be published. Required fields are marked *