Please can some one explain me whether I can use both of default and jQuery in single rails application ??? Because I currently working with rails project which developed using default JavaScript file but I need to use jQuery JavaScript file as well so is it possible.
Asked
Active
Viewed 92 times
0
-
1jquery is javascript you can use it along with simple JS – Rafay Sep 14 '11 at 04:17
-
Doesn't it create problems when we use both in single page ?? – SL_User Sep 14 '11 at 04:19
-
Which version of rails are you using ? Is it greater than 3 or less than – Vik Sep 14 '11 at 05:13
-
no I'm using rails 2.3.8 – SL_User Sep 14 '11 at 05:29
2 Answers
1
nope the problem arises when you use multiple plugins on the same page or you use more than one JS liberaries on the same page like jquery
and dojo
for that you have to use noConflict
but if you want to use javasctipt along with jquery on the same page that is not a problem.
1
Default library in 2.3.8 is prototype and that's conflicting when you are using ....
Just add the library in the below format :
<head>
<script type="text/javascript" src="/obp/js/prototype.js"></script>
<script type="text/javascript" src="/obp/js/jquery.js"></script>
<script type="text/javascript">
jQuery.noConflict();
var $j = jQuery;
</script>
</head>

Vik
- 5,931
- 3
- 31
- 38