1.jquery.extend(object); To extend the jQuery class itself. Add new methods to the class.
jquery.fn.extend(object); Add methods to jQuery objects.
$.extend({ add:function(a,b){return a+b;} }); //$.add(3,4); //return 7
jQuery adds a "static method" called add, and then you can use this method where jQuery is introduced.
2.jQuery.fn.extend(object); To extend jQuery.prototype is to add "member functions" to the jQuery class. Instances of the jQuery class can use this "member function".
$.fn.extend({ alertClick:function(){ $(this).click(function(){ alert($(this).val()); }); } }); //页面上为: <input id="input1" type="text"/> //使用 $("#input1").alertClick();
The above is the entire content of this article, I hope you all like it.