I have a script i insert in to an HTML page when it is browsed. My script uses the latest version of jQuery and i am running in to issues with people that already have an older version of jQuery declared on their page. I have been re-assigning my jQuery object to my own varialbe to avoid the conflict, but i am wondering: Is it possible to insert jQuery in to my own object without having to re-assign variable? I mean going from something like:
var myJquery = jQuery.noConflict(true);
to something like
myCustomObject.prototype.jQuery = //how do i populate this?
myCustomObject.jQuery.blahblah();
Im am wanting my version of jQuery to be a member of my javascript object.
If you’re including jQuery core without modifying it, you can’t do this…it overwrites the
window.jQueryobject itself, that’s where the issues start. Number one example: redeclaringwindow.jQueryand by proxywindow.jQuery.prototypeyou erase all plugins in the page.Check if
window.jQueryexists before including it…otherwise you need to change jQuery core, in particular this line:To something like:
In that context the
jQueryon the end is a variable local the scope at that point, not yet screwing up much.