jQuery extend

http://www.iteye.com/topic/545971

 

Java code collection code
(function($){     
$.fn.extend({     
pluginName: function (opt, callback) {     
          // Our plugin implementation code goes here.       
}     
})     
})(jQuery);     
Form 2:
Java code collection code
(function($) {       
$ .fn.pluginName = function () {     
     // Our plugin implementation code goes here.     
};     
})(jQuery);      
       A jQuery function is defined above, and the formal parameter is $. After the function definition is completed, the actual parameter of jQuery is passed in. Immediately call and execute. The advantage of this is that when we write jQuery plugins, we can also use the $ alias without causing conflicts with prototype.

 

 

(function($){     
$.fn.extend({     
pluginName: function (opt, callback) {     
          // Our plugin implementation code goes here.       
}     
})     
})(jQuery);   

 

jQuery.fn.extend(object); Add method to jQuery object.
jQuery.extend(object); extends the jQuery class itself. Adds new methods to the class

 

$.validator = function( options, form ) {
	this.settings = $.extend( true, {}, $.validator.defaults, options );
	this.currentForm = form;
	this.init();
};


$.extend($.validator, {

})

$.fn.validator = function( options, form ) {
	this.settings = $.extend( true, {}, $.validator.defaults, options );
	this.currentForm = form;
	this.init();
};


$.extend($.fn.validator, {

})

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326082183&siteId=291194637