1

I'm using 2 different modules in JQuery that each use the UI library. One module uses version 1.8.5 and the other uses 1.7.2.

The problem I'm having is that one of the two modules stops working when I attempt to load both UI libraries. I'm brand new to JQ so I'm not sure what to do about this.

EDIT: Can someone please tell me what I need to do with this? Do I need to choose one plugin over the other? How does one resolve this?

I'm using jquery datepicker and jquery.editinplace.js

jim
  • 11
  • 2

2 Answers2

3

You cannot use two jQuery UI libraties out of the box.

You need to rewrite older plugin to make it work with newer jQuery-UI ir modify one of jQuery-UI versions.

Māris Kiseļovs
  • 16,957
  • 5
  • 41
  • 48
  • Whan you say rewrite, what or how do I do that? – jim Oct 13 '10 at 14:00
  • He means edit the older library to make it work with the newer version of the jQuery UI library. You may also want to edit your question to add the names of the two modules you are using – Dave Oct 13 '10 at 14:24
  • @jim chances are it's not even necessary to rewrite anything. Try running everything against the newest library first – Pekka Oct 13 '10 at 14:50
  • Thanks Pekka, I have done that already but everything stops working. If I remove the inline script that calls the libraries, one by one, only one plugin works. I can only get one or the other to work at one time. – jim Oct 13 '10 at 14:55
  • @jim in that case, it's probably best to turn to the product's authors to ask whether they have any plans to update it to work with the new library. This kind of compatibility issue often has no simple solution, and can take hours or days of skilled work to sort out – Pekka Oct 13 '10 at 15:03
  • I gotcha, Pekka, thank you. At least I know what I'm up against. :) – jim Oct 13 '10 at 15:05
  • Pekka, can you tell me what the difference between the jquery-min file and the jquery.js file? Do I need them both? – jim Oct 13 '10 at 15:06
  • 1
    @jim: it's the same code but jquery-min.js is "minified" so it takes less bytes. You need to use only minified version. Non-minified version is needed only if you want to read jquery source. – Māris Kiseļovs Oct 14 '10 at 13:32
3

Well, it is possible, but it's a bit of a hack. I'd recommend finding an in place editor that works with newer versions of jQuery. I'm assuming you are using this edit in place plugin, there is already a bug filed that mentions it does not work with jQuery 1.4.x

You could get around this by using noConflict

<!-- Newest jquery version -->
<script src="jQuery1.4.2.js"></script>
<script>
    var $jq14 = jQuery.noConflict(true);
</script>

<script src="jQuery1.3.2.js"></script>

Then use $("#edit").editInPlace( etc ) for your edit in place stuff and the $jq14() operator for the newer jQuery stuff. Note that it's important to load the older version last and to let it have the $() operator.

Mostly stolen from this previous StackOverflow question, which you should read. The answer describes it better than me.

Community
  • 1
  • 1
Dave
  • 416
  • 2
  • 5