Search code examples
javascriptjqueryajaxprototypejs

Conflict with prototype javascript


I have javascript calendar appears when the user click on a text box and I must call the prototype.js from the following link in-order to allow the calendar to work https://ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js

The calendar works fine but I found that all the other javascripts in my page stopped working!

Any suggestions?


Solution

  • It can be when you want to use two and more different libraries on one page. In that case the libraries goes in conflict, when the same function names exist in all libs at the same scope. In this cases the last function implementation will be used.

    For example, you implement some function fn() in the global scope and after that implementation you insert some library that also implement the function fn() in the same scope. The second function reimplement the first and by each call of the fn() the browser will use the second implementation instead of your.