Net-informations.com
SiteMap  | About    

jQuery toggleClass()



The method toggleClass() alternates between adding and removing the specified classes to the selected elements.

Syntax

This method checks each element for the specified class names. The class names are added if missing, and removed if already set.

The following code create a toggle effect in your webpage. This method takes one or more class names as its parameter.

The above code would remove a class with one click and in second click it would again add the same class. As with the other methods, multiple class names can be provided, separated by a space.

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.