(function($) {      // closure
$.fn.hilight = function( options ) { //将方法定义在$的fn上
var defaults = {
textColor: "#000",
backgroundColor: "#fff"
};
var settings = $.extend( {}, defaults, options );
return this.each(function() {
// Plugin code would go here...
});
};
})(jQuery);

使用

$(elem).hilight(options)
//或者
$.fn.hilight.call($(elem),options)
05-11 14:44