Hi all,
I have this rails website that works fine, but I wanted to experiment
with jQuery a little so I added all the necessary file to my JavaScript
folder and, well, all hell broke lose in that adding jQuery causes
Scriptaculous/Prototype not to work while jQuery works kinda-fine. Doing
a search on Google and even here, the overwhelming majority of people
suggested the solution of using jQuery.noConflict(); to relinquish
control of the $ variable back to Prototype. However, after struggling
with this for almost a full day I can say with 100% certainty that this
is not the cause of my problem.
I also tried:
(function($) {
$(document).ready(function(){
.....
});
})(jQuery);
with no luck. I get no JavaScript errors, but what I do get is a line
under my text_boxes, which use auto_complete, which usually only happens
when I have multiple tags with the same id on the same page, but I know
for a fact that is not the problem here.
So I am really at a loss, just wondering if anybody has had this same
issue and how did they fix it? I''m using Rails 2.3.4 and jQuery 1.5.2.
Thanks,
-S
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
I fixed it. Here was the problem. In my JavaScript include lines I had this: <%= javascript_include_tag :defaults, ''scriptaculous'', ''prototype'', ''effects'', ''controls'', ''date-picker'', ''jquery'', ''jquery.min'', ''application'' %> <script> // Don''t take this out as long as you are using the jQuery and Scriptacous libraries together. They don''t play well together. var $j = jQuery.noConflict(); </script> And I changed it to this: <%= javascript_include_tag ''jquery'', ''jquery.min'' %> <script> // Don''t take this out as long as you are using the jQuery and Scriptacous libraries together. They don''t play well together. var $j = jQuery.noConflict(); </script> <%= javascript_include_tag :defaults, ''scriptaculous'', ''prototype'', ''effects'', ''controls'', ''date-picker'', ''application'' %> Apparently the relinquishing of this all import variable $ must be done after I include the necessary jQuery script files but before I include the Sciptaculous/Prototype script files. Hopefully this helps someone. -S -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Aug 18, 2011, at 5:33 PM, Shandy Nantz wrote:> <%= javascript_include_tag :defaults, ''scriptaculous'', ''prototype'', > ''effects'', ''controls'', ''date-picker'', ''application'' %>This could be written more neatly as javascript_include_tag :defaults, :date-picker :defaults loads the entire Prototype/Scriptaculous stack, plus application.js. Walter -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.