Skip to content

Instantly share code, notes, and snippets.

@seutje
Created May 30, 2011 11:37
Show Gist options
  • Select an option

  • Save seutje/998767 to your computer and use it in GitHub Desktop.

Select an option

Save seutje/998767 to your computer and use it in GitHub Desktop.
silly replaceClass plugin
(function($) {
jQuery.fn.replaceClass = function(toReplace,replaceWith){
return this.each(function(){
return $(this).removeClass(toReplace).addClass(replaceWith);
});
}
})(jQuery);
@miketaylr
Copy link
Copy Markdown

So like

$('#awesome').replaceClass('grey', 'breakwater')

:D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment