Latest web development tutorials

jQuery jQuery.sub () method

jQuery Misc Methods jQuery Misc Methods

Examples

Add a method to the jQuery sub, so that it will not be exposed

(Function () { var . sub = jQuery sub (); .. sub fn myCustomMethod = function () { return 'Just for me';}; . Sub (document) ready (function () { alert (sub ( 'body') myCustomMethod ().);}); alert (typeof jQuery ( 'body') myCustomMethod) ;. // underfine }) ();

try it"

Definition and Usage

$ .sub () Function creates a new copy of jQuery, its properties and methods can be modified without affecting the original jQuery object.


Note: 1. From the start jQuery1.7 obsolete in jQuery 1.8 version will be moved to a plug-in.
2. $ .sub () does not try to do any form of isolation. All copies of jQuery still points to the original method of jQuery. (For example, will still be carried out by the original jQuery event bindings and triggers, data will be bound to the element .Ajax requests and events are also run by the original jQuery, etc. from the original jQuery.)


grammar

Tip: This method does not accept any parameters.


$.sub()


Examples

More examples

Rewrite some of the jQuery method
Rewrite some of jQuery methods, provide new functionality.

Create a plug
Create a plug-in, plug-in returns the specific methods.


jQuery Misc Methods jQuery Misc Methods