$.extend({foo:function(){alert('hi!')}}) ;
$.foo()上面的写法有何好处,像下面这样也能扩展一个函数$.foo=function(){alert('hi!')};
$.foo();这样写法更简单,为何用$.extend?
1 回答
已采纳

LIANHK
TA贡献78条经验 获得超17个赞
jQuery.extend({ foo: function() { alert('This is a test. This is only a test.'); }, bar: function(param) { alert('This function takes a parameter, which is "' + param +'".'); } });
因为可以像这样,一次添加多个全局函数,望采纳谢谢!
添加回答
举报
0/150
提交
取消