0

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

Hi,

in page i use jquery 1.4.4 version, but one of my script request older versio. I insert old jquery version and set new name:

<script type="text/javascript">var jq132 = $.noConflict(true);</script>

Then i get error on this line:

jq132("#docs_file ul").sortable({ opacity: 0.6, cursor: 'move', update: function()

Jus show(Firefox debuger): jq132("#docs_file ul").sortable is not a function

jq132(document).ready(function()
{   
    jq132(function()
    {
        jq132("#docs_file ul").sortable({ opacity: 0.6, cursor: 'move', update: function()
        {
            var order = $(this).sortable("serialize") + '&action=Listings'; 
            jq132.post("order.php", order, function(theResponse){
                jq132("#error").html(theResponse);
            });                                                              
        }                                 
        });
    });

});
Community
  • 1
  • 1
lolalola
  • 3,773
  • 20
  • 60
  • 96

2 Answers2

0

You need to call noConflict after including every plugin that you want to use.

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
0

sortable is a plug-in, which means it will try to add itself to jQuery by assigning to the jQuery.fn object. So if you want to use plug-ins with the older jQuery, you'll have to load them before you rename jQuery and before you load the newer version of it. E.g.:

<script src='jquery132.js'></script>
<script src='some.plugin.js'></script>
<script>var jq132 = jQuery.noConflict(true);</script>
<script src='jquery144.js'></script>
<script src='some.plugin.js'></script>

Note that lines 2 and 5 are the same. The first one will add that script to jQuery 132. The second will add it to jQuery 1.4.4. Maybe. If the script doesn't have its own global symbols. If it doesn't assume jQuery will continue to reference jQuery (which is a fairly reasonable assumption for it to make).

Live example

T.J. Crowder
  • 1,031,962
  • 187
  • 1,923
  • 1,875