Thinking about this more, the best way to do this would probably be to create a single file that contains the version of jQuery you want to use, plus some extra code that calls jQuery.noConflict(true) and adds methods to manage the instance of jQuery that you care about. You could do something like this (untested):
// jQuery code here ;(function() { var $mine = window.$mine = jQuery.noConflict(true); $mine.fn.loadPlugin = function(plugin) { var _jQuery; if (typeof window.jQuery != "undefined") { _jQuery = window.jQuery; } window.jQuery = $mine; $mine.ajax({ type: "GET", url: plugin, dataType: "script", async: false, complete: function() { window.jQuery = _jQuery; } }); })(); I'm not positive that making the request synchronous will lock the browser. If not, you would run the risk of having other code run between the swapping of jQuery instances, which could lead to problems. On Feb 2, 12:06 pm, "Scott González" <[EMAIL PROTECTED]> wrote: > I created a test page for this a while ago when someone else asked > about this. I believe the context was that they were using a > framework which had jQuery 1.0.4 bundled in and they wanted to use > jQuery UI, which required jQuery 1.2. > > You can see the method I used > athttp://scottsplayground.com/temp/jquery_versions/ > (you have to view source, there's no actual content on the page). > You'll notice that in my implementation, I left the old version > (1.0.4) as jQuery. I did this so that any other plugins loaded by the > framework would go to the version it expected. This would be the > trickiest part of using multiple versions of jQuery at the same time. > Since plugins will always add to whichever version is contained in the > jQuery variable, you'll need to do some shuffling if you're going to > be dynamically loading plugins for multiple versions. > > On Feb 1, 4:05 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > > Using jQuery with other libraries is easy: > > >http://docs.jquery.com/Using_jQuery_with_Other_Libraries > > > What I'd like to do is do inject jQuery in pages where jQuery already > > might exists and even might exist in some other version. Is there a > > way to do this safely or do I need to rename the main object? Any > > Ideas? > > > mot