How to add a new class to an element that already has a class using jQuery ?
In this article, we will learn to add a new class to an element that already has a class using jQuery. To add a new class, we use jQuery addClass() method. The addClass() method is used to add more classes and their attributes to each selected element. It can also be used to change the property of the selected element.
Parameters: It accepts a parameter “className”, the name of the new class that is to be added.
Before Click the Button:
After Click Button:
Attention reader! Don’t stop learning now. Get hold of all the important Comcompetitivepetitve Programming concepts with the Web Design for Beginners | HTML course.