How to use jQuery with Other Libraries like Prototype

Prototype and jQuery conflict over the $ function.

Prototype gives you a huge jump start when creating enhanced user interfaces for web apps. It gives a developer a large set of functions that allow one to write JavaScript code without messing with cross browser details.

But as good as Prototype is, many of us are starting to switch over to jQuery. jQuery allows for really easy coding that is based off of CSS and actions, rather then function after function after function in Prototype. Unfortunately, these two libraries conflict with the use of the $ function. It is basic to both frameworks and, of course, they both use it differently.
However, you can override that default by calling jQuery.noConflict() at any point after jQuery and the other library have both loaded.
For example:

This will revert $ back to its original library. You’ll still be able to use “jQuery” in the rest of your application.

Another Example:

About the author

Janaki(http://mjanaki.com) - A Software developer with 9+ years of experience in multiple technology projects across web, mobile, and cloud applications with expertise in PHP, C#, MySQL, Web services and open source platforms.

Similar Posts

Regular Expression Special Character
CK Editor validation in javascript
5 Ways to Make Ajax Calls with jQuery

Leave a reply

required*

Eye Test: * Time limit is exhausted. Please reload CAPTCHA.