/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$.fn.swapClass = function(c1, c2){ return this.each(function(){ var t = $(this); (!t.is('.'+c1)) ? t.addClass(c1).removeClass(c2) : t.addClass(c2).removeClass(c1); }); }