Replace class in jQuery

Many time developer face situation where they have to switch the class with other class and some another event they have to return back.

In the example below, we're selecting the container element using its ID and using the removeClass() method to remove the even class from it. Then, we're using the addClass() method to add the odd class to the same element.

See the Pen Replace class in jQuery by Nirbhay (@nirbhaysingh) on CodePen.

No comments :

Please Give Your Feedback