Created
January 29, 2010 07:28
-
-
Save dandean/289525 to your computer and use it in GitHub Desktop.
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
| Element.addMethods({ | |
| /** | |
| * Element extension to swap out one class for another on an element. | |
| **/ | |
| swapClassName: function(element, oldClassName, newClassName) { | |
| if (!(element = $(element))) return; | |
| return element.removeClassName(oldClassName).addClassName(newClassName); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment