How can I use the JavaScript Prototype framework along with the jQuery framework at the same time?

Question by John: How can I use the JavaScript Prototype framework along with the jQuery framework at the same time?
After adding a reference to the jQuery framework in my code, the Prototype-dependent parts of my code failed to run properly.

How can I use both together?

Best answer:

Answer by two pi
I know it’s been done,

http://dev.jquery.com/wiki/PrototypeAndJQuery

but it would be difficult, as both create functions that would conflict (particularly the critical $ () function.)

I think it makes a lot more sense to just pick one or the other, because combining the two adds a lot of confusion and very little advantages.

They really do most of the same things, albeit in different ways.

I’ve personally moved more towards JQuery as I really like the AJAX and selection tools better.

Good luck to you.

What do you think? Answer below!

No related content found.

Revisions

There are no revisions for this post.

Tags: , , , , , ,

One Response to “How can I use the JavaScript Prototype framework along with the jQuery framework at the same time?”

  1. bertyblunt October 22, 2011 at 11:23 PM #

    I believe jQuery has a compatibility mode – jQuery.noConflict() – specifically for use when deploying with other frameworks. It’s especially handy for use with prototype as they both use the $ function. Have a look at the sources below to see how to trigger it, it looks like you will need to tweak your jQuery scripts a bit.

Leave a Reply