Skip to content

Instantly share code, notes, and snippets.

@georgeOsdDev
Created January 1, 2013 14:25
Show Gist options
  • Save georgeOsdDev/4427852 to your computer and use it in GitHub Desktop.
Save georgeOsdDev/4427852 to your computer and use it in GitHub Desktop.
jquery.switchClass snippet
(($) ->
$.fn.switchClass = (from, to="") ->
$(@).removeClass(from).addClass(to)
$(@)
) jQuery
// Generated by CoffeeScript 1.4.0
(function() {
(function($) {
return $.fn.switchClass = function(from, to) {
if (to == null) {
to = "";
}
$(this).removeClass(from).addClass(to);
return $(this);
};
})(jQuery);
}).call(this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment