这两种方式等效:
/**
用法
$("#bb").tooltip1();
$("#bb").tooltip2();
*/
(function ($) {
$.fn.tooltip1 = function( options ) {
var $this = $(this);
var txt = $this.html();
alert(txt);
};
$.fn.extend({
tooltip2:function( options ) {
var $this = $(this);
var txt = $this.html();
alert(2);
}
})(jQuery);