您好,欢迎来到爱go旅游网。
搜索
您的当前位置:首页$.fn,$.extend(),$.fn.extend(),$.extend($.fn,{})

$.fn,$.extend(),$.fn.extend(),$.extend($.fn,{})

来源:爱go旅游网

$.fn

jQuery.fn 其实是 jQuery对象的原型,也就是jQuery.fn=jQuery.prototype

所以我们就可以用来给jquery的原型添加方法或者属性,那么所有jquery的实例化对象,都会具有添加的方法,或者属性。

$.fn.say=function(){
    console.info("hello");
};

$("#div1").say();

$.fn.extend()

这个方法和上面的是一样的

$.fn.extend({
    say : function(){
       console.info("hello");
    }
});

$("#div1").say();

$.extend()

$.extend({
    say : function(){
    console.info("hello");
    }
});

$.say();

jQuery.extend($.fn,{})

这个和$.fn.extend()是一样的

$.extend($.fn,{
say : function(){
console.info("hello");
}
});

$("#div1").say();

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- igat.cn 版权所有 赣ICP备2024042791号-1

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务