0

i got plugins using 3 different versions of jQuery on my site "1.7.1" "1.5.2" and "1.3.2". Got first 2 on my main page and theyre working just fine, but when i enter a site that uses the third one aswell, addons based on 1.7.1 and 1.5.2 stop working.

I did try adding jq132 = jQuery.noConflict(true); script, and then switching every $ in third app to jq132, but that doesnt seem to work. Any tips?

EDIT: i managed to cut out 1.5.2 and 1.3.2 versions, thanks for tips

6
  • 4
    Here's a tip: Use one version of jquery. Commented Feb 7, 2012 at 2:08
  • Just curious: Why do you have 3 different versions of jQuery on the same page? Commented Feb 7, 2012 at 2:08
  • because i got 3 js apps that use different versions if jQuery, how could i use just one version in this case? Commented Feb 7, 2012 at 2:10
  • @Ates Goral, yea true, I guess when I go to the gas station and fill up I use a little from 87, a little from 89 and top it off with some 92. Commented Feb 7, 2012 at 2:10
  • 1
    USe the latest version. Its backward compatible. Better still upgrade your js plugins. Here, we crib about including as little code as possible to speed things up and you're using 3 different versions of jquery. The footprint will be enormous Commented Feb 7, 2012 at 2:13

2 Answers 2

1

You could try editing each version of jQuery to change the namespace variable for each version if you really need all three versions (which you really don't, btw).

(function( window, undefined ) {

// Use the correct document accordingly with window argument (sandbox)
var document = window.document,
    navigator = window.navigator,
    location = window.location;

var jQuery132 = (function() {

// Define a local copy of jQuery
var jQuery = function( selector, context ) {

and then in your $(document).ready():

jQuery132(document).ready(function($132) {
   // code goes here
});

and your $ would be replaced with $132 for your 1.3.2 version and so on.

Btw, this is a really bad idea.

Sign up to request clarification or add additional context in comments.

Comments

1

What you're probably doing wrong is not calling $.noConflict right after including a version of jQuery. After every jQuery include tag, there needs to be <script> tag with $.noConflict for that version of jQuery.

See: Can I use multiple versions of jQuery on the same page?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.