views:

798

answers:

3

I have been using jQuery and I need to use Scriptaculous and Protoype. I have tried using the jQuery library extending another library. I defined it using the following syntax:

jQuery.noConflict();
jQuery(document).ready(function() {
});

My jQuery works properly and I have divided the three modules.

I need to have all three modules on the same page. I know using all three different libraries is not very efficient, but I don't see another way.

  • For validation I am using jQuery and AJAX (as an example: validation.js).

  • The rest of my animation uses Prototype and Scriptaculous. (as an example: animation.js).

I have separated the script files. My problem is that now if my animation part works properly, then the AJAX part doesn't work.

If the AJAX part is working the validation is not working.

I am replacing the code but I am still unable to integrate.

Questions:

  1. Does jQuery provide any simple way to make this work?

  2. Is there any procedure that Prototype and Scriptaculous has that should not conflict with JQuery?

+2  A: 

I think the best thing you can do is to switch your AJAX and validation from jQuery to Prototype. That should fix the problems. Prototype has good validation and AJAX too.

http://prototypejs.org/api/ajax

and for validation just google "prototype validation".

You could also switch the animation part to jQuery (it has very nice animation functions).
http://docs.jquery.com/Effects

I would personally do the latter since I prefer jQuery's non interference with the object.prototype chain.

Pim Jager
A: 

You're better off picking one set of libraries. jQuery and Prototype can both handle the same sort of stuff, and they don't much like to play in the same sandbox.

ceejayoz
A: 

Here's an easier answer (not mine - can't take credit)

http://stackoverflow.com/questions/112721/combining-scriptaculous-and-jquery-in-a-rails-application

Debra