jQuery plugin development
1:(function($){
})(jQuery)
2: Define the method
a:
$.test2=function () {
alert("test2");
}
Reference in the page $.test2();
b:
$.fn.mytest=function(){
alert("mytest");
}
Reference in the page $("#abc").mytest();
c: cover
$.extend({
add:function(a,b);
});
References in the page $.add(3,4);
complete example
(function($){
$.test=function () {
alert("test");
}
var private3=function () {
alert("private3");
}
$.fn.mytest=function(){
var privatetest = function () {
alert("private");
}
privacy test ();
$.test();
private3();
}
$.extend({
add:function(a,b){return a+b;}
});
})(jQuery)