Using prototype over the jQuery

How to use multiple conflicting JavaScript libraries in a project

I have recently involved with integrating two different project components which are using jQuery and Prototype JavaScript libraries. One of major issue was projects are almost completed and having huge JavaScript code base. Initially integration was quite difficult because project was depending on specific JavaScript library versions. Requirement was to integrate code together without harming the existing code. Fortunately, jQuery code parts were very easy to modify, having known these kind of situations.

jQuery.noConflict() has one simple purpose.It enables you to load multiple instances of jQuery on the same page typically different versions of jQuery at that. You may be wondering why you would ever want to do that. There are two primary reasons. First, you may want to use a jQuery plugin that is not compatible with the newest version of jQuery, while writing most of your jQuery code on the newest version of jQuery. Second, you may have no control over what jQuery version is loaded on a page,and you need to be sure a specific version of jQuery is loaded for your jQuery code or jQuery plugin to work.

One of major issue was conflicting $ with jQuery and Prototype. While researching over the internet solution was became quite easy.

In conclusion, jQuery.noConflict() is an extremely powerful code block , and can be used to do great things for the Web. I hope you have found this article useful and informative.

Show your support

Clapping shows how much you appreciated Sampath Thennakoon’s story.