How to use rails.js and prototype.js librarys
The problem
I wanted to use some interface element in Rails that requires prototype.js so I had to have both librairies. The problem is that there's a conflict between them. Prototype.js doesn't seem to give a damn about it but jQuery is nicer with you. It offers a noConflict method.
With Rails, prototype.js is the default librairie so to override this, you could do
- <%= javascript_include_tag "prototype", "jquery" %>
- <script>$j = jQuery.noConflict();</script>
This way, you will have to use $j instead of $ to call jQuery.$ would still call prototype.
Another thing you could do is to use jQuery on Rails and don't give a damn about scriptaculous. I personally prefer to use librairies that are fully tested instead of using a "by-pass" that could break my code. It's your choice…
--
G SubbaRao
Cell:08970668850
E-Mail:subbarao.kly@gmail.com
Comments
Post a Comment