Net-informations.com
SiteMap  | About    

jQuery Add/Remove Classes



addClass() Method

The addClass() method adds one or more class names to the selected elements. This method does not remove existing class attributes, it only adds one or more class names to the class attribute.

The above code add two classes for p and div elements and changed the backgroung when click the button.

removeClass() Method

The removeClass() enables you to remove a single class, multiple classes, or all classes from each element in the set of matched elements.

The above code remove two classes for p and div elements and changed the backgroung when click the button.

run this source code Try it Yourself

This is a paragraph



This is a Div


Full Source









net-informations.com (C) 2018    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.