Created
April 2, 2016 10:13
-
-
Save hsleonis/067041c484cfc41f161d026e73b97a5b to your computer and use it in GitHub Desktop.
Toogle css class without conditions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Toggle two classes | |
| */ | |
| $("#toggler").toggleClass("lightOn lightOff"); | |
| /** | |
| * Wrap an HTML structure around each element in the set of matched elements | |
| * Reference: http://api.jquery.com/wrap | |
| */ | |
| $( ".inner" ).wrap( "<div class='new'></div>" ); | |
| // or | |
| $( ".inner" ).wrap(function() { | |
| return "<div class='" + $( this ).text() + "'></div>"; | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment