jquery的扩展方法

jquery 提供两个扩展方法

1.jQuery.fn.extend(object);

2.jQuery.extend(object);

1是为jquery对象添加扩展方法

2.是为jquery本身添加扩展方法

$.fn.extend({fn1:function(){

alert($(this).val());

},

fn2:function(){

alert($(this).text());

}});

调用 $("#input").fn1();

$.extend({fn3:function(){alert("hehe");}})

调用 $.fn3();

原文地址:https://www.cnblogs.com/lovejunxia/p/2826103.html