(function($) {
$.fn.switchClasses = function(switches) {
return this.each(function() {
var that = this;
$.each(this.attr("class").split(' '), function(i, classname) {
var func = switches[classname];
if(func){
func.apply(that, classname);
}
});
});
};
})(jQuery);
“class”是保留名称,
我加了一些缺少的括号