这个是jquery插件的形式,举个例子:

<div ></div>

(function($){
$.fn.extend({
test:function(){
alert($(this).attr('id'));
}
})
})(jQuery)

$('#myDiv').test();
打印出 : myDiv

(function($){
$.extend({
test:function(){
alert('111');
}
})
})(jQuery)
$.test();
打印出:111

前者是绑定在页面元素上的插件,后者是 绑定在jquery上的插件。

相关文章:

  • 2021-05-28
  • 2022-12-23
  • 2021-08-17
  • 2021-11-30
  • 2021-12-10
  • 2021-12-10
  • 2021-12-10
  • 2021-08-25
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-28
  • 2022-12-23
  • 2021-05-27
相关资源
相似解决方案