$.extend()
全称:jQuery.extend()
扩展 jQuery 类本身,为jQuery类添加类方法
用法:
$.abc = function(){}
菜鸟教程
https://www.runoob.com/jquery/misc-extend.html
$.fn.extend
全称:jQuery.fn.extend
jQuery.fn = jQuery.prototype,就是原型(每个对象也都有一个原型成员 prototype,通过 new 函数创建的对象会通过函数的 prototype 找到函数的原型)
jQuery.fn.extend 就是扩展原型(jQuery对象)的方法
对象就是类的实例化
$("#select") 就是一个实例化的jQuery对象
所以jQuery.fn.extend拓展的方法,只能用在jQuery对象上面
$(’#selector’).abc();
你要是这么用$.abc(); 会出错误的
用法
$.fn.abc = function(){}
jQuery.extend()这个方法,主要是用来拓展个全局函数啦,例如$.ajax() ,
$.each() 遍历指定的对象和数组
大部分插件都是用jQuery.fn.extend()。