A function used to return the name of the style class to toggle on each element in the matching element collection:
If the second argument is callback, then the class name needs to be returned, and the function arguments are interpreted as follows:
1: Receive element's index position and element old style class as parameter
2: A Boolean value to determine whether the style class is added or removed
3. Boolean value to determine if the element contains Class (Sw[switch])
Instance:
<! DOCTYPE html>Input{font:13px/20px ' Courier New '; color: #000;} . addone{padding:08px;} . addtwo{color:#999;} Button[type= ' button ']{font:400 13px/1.2em ' Courier New ';p adding:3px;} </style><script type= ' Text/javascript ' > $(function(){ $(' button '). Click (function(){ $(' #user '). Toggleclass (function(index,oldclass) {return' AddTwo '; }); }); });</script>[jquery Method Toggleclass (CLASS|FN[,SW])] This method deletes (adds) a class if it exists (does not exist)