这两种方式等效:


/**
用法
$("#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);

 

 

posted on 2017-11-16 11:30  time_on  阅读(159)  评论(0编辑  收藏  举报