Reputation:
Which is proper way creating a copy from jQuery?
var copyjq = new jQuery;
var copyjq
or what?
Upvotes: 1
Views: 55
Reputation: 700562
Use the sub
method to create a copy of jQuery:
var copyjq= jQuery.sub();
Note: For version 1.9 and later the method was moved to a plugin.
If you just want another name for jQuery, and not a separate copy, you can just copy the reference:
var copyjq = jQuery;
You can also isolate the name inside a function expression:
(function(copyjq){
...
}(jQuery));
Upvotes: 3