爱程序网

$.fn和$.extend书写方式

来源: 阅读:

$.extend({
addMe:function(a,b){
console.log(a + b);
}
});

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

console.log(this);
}
});


$.extend($.fn,{
showAge:function(){
console.log(this[0].dataset.age);


}
});


$("#test").showAge();
$("#test").showTest();
$.addMe(4,9);

 

此上三种写法都可以

关于爱程序网 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 人才招聘 - 帮助