I have a library conflict between jQuery.js & accordion.js The first line of accordion.js is $(document).ready(function() { Firebug displays $(document).ready is not a function I have read http://docs.jquery.com/Using_jQuery_with_Other_Libraries. This link is an explanation of how to resolve the conflict. To that end I have in a partial haml file (function($) { = javascript_include_tag ''accordion.js'' })(jQuery); The rendered output is (function($) { <script src="/assets/accordion.js?body=1" type="text/javascript"></script> })(jQuery); but I am still getting the $(document).ready is not a function error message. Is what I am trying to do even legal? -- 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.
Put `= javascript_include_tag ''accordion.js''` outside your jquery listeners: _my_partial.haml = javascript_include_tag ''accordion'' :javascript (function($) { // jquery listeners here })(jQuery); On Fri, Dec 30, 2011 at 2:21 PM, Ralph Shnelvar <ralphs-bVGy8FV858MAvxtiuMwx3w@public.gmane.org> wrote:> I have a library conflict between jQuery.js & accordion.js > > The first line of accordion.js is > > $(document).ready(function() { > > > Firebug displays > $(document).ready is not a function > > > I have read http://docs.jquery.com/Using_jQuery_with_Other_Libraries. This link is an explanation of how to resolve the conflict. > > > > To that end I have in a partial haml file > > (function($) { > = javascript_include_tag ''accordion.js'' > })(jQuery); > > > The rendered output is > (function($) { > <script src="/assets/accordion.js?body=1" type="text/javascript"></script> > })(jQuery); > > > > but I am still getting the > $(document).ready is not a function > error message. > > > > Is what I am trying to do even legal? > > -- > 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@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. >-- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Fri, 2011-12-30 at 12:21 -0700, Ralph Shnelvar wrote:> I have a library conflict between jQuery.js & accordion.js > > The first line of accordion.js is > > $(document).ready(function() { > > > Firebug displays > $(document).ready is not a function > > > I have read http://docs.jquery.com/Using_jQuery_with_Other_Libraries. This link is an explanation of how to resolve the conflict. > > > > To that end I have in a partial haml file > > (function($) { > = javascript_include_tag ''accordion.js'' > })(jQuery); > > > The rendered output is > (function($) { > <script src="/assets/accordion.js?body=1" type="text/javascript"></script> > })(jQuery); > > > > but I am still getting the > $(document).ready is not a function > error message. > > > > Is what I am trying to do even legal?---- sounds as if you tinkered with application.js or removed the reference to it completely and thus jquery isn''t loaded at all. Craig -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- 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.
Ralph Shnelvar
2011-Dec-31 17:08 UTC
Re[2]: Conflicting libraries: jQuery.js & accordion.js
Friday, December 30, 2011, 7:09:08 PM, you wrote: CW> On Fri, 2011-12-30 at 12:21 -0700, Ralph Shnelvar wrote:>> I have a library conflict between jQuery.js & accordion.js >> >> The first line of accordion.js is >> >> $(document).ready(function() { >> >> >> Firebug displays >> $(document).ready is not a function >> >> >> I have read http://docs.jquery.com/Using_jQuery_with_Other_Libraries. This link is an explanation of how to resolve the conflict. >> >> >> >> To that end I have in a partial haml file >> >> (function($) { >> = javascript_include_tag ''accordion.js'' >> })(jQuery); >> >> >> The rendered output is >> (function($) { >> <script src="/assets/accordion.js?body=1" type="text/javascript"></script> >> })(jQuery); >> >> >> >> but I am still getting the >> $(document).ready is not a function >> error message. >> >> >> >> Is what I am trying to do even legal?CW> ---- CW> sounds as if you tinkered with application.js or removed the reference CW> to it completely and thus jquery isn''t loaded at all. Craig: I modified accordion.js by wrapping it in (function($) { ... })(jQuery); And everything works. If I don''t do it, the text (function($) { })(jQuery); ends up being displayed on the webpage as the 1st two lines. I didn''t see it before. -- 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.
Ralph Shnelvar
2012-Jan-01 16:56 UTC
Re[2]: Conflicting libraries: jQuery.js & accordion.js
Zachary, This is over my head. a) What does the :javascript do? Where is it documented? b) What''s a jquery listener? I have googled "jQuery listener" and a lot of stuff comes up. I need an introduction/overview. Speaking of which, is there a good introduction to javascript for programmers? Same for jQuery. Thanks! Ralph Friday, December 30, 2011, 3:14:35 PM, you wrote: ZS> Put `= javascript_include_tag ''accordion.js''` outside your jquery listeners: ZS> _my_partial.haml ZS> = javascript_include_tag ''accordion'' ZS> :javascript ZS> (function($) { ZS> // jquery listeners here ZS> })(jQuery); ZS> On Fri, Dec 30, 2011 at 2:21 PM, Ralph Shnelvar <ralphs-bVGy8FV858MAvxtiuMwx3w@public.gmane.org> wrote:>> I have a library conflict between jQuery.js & accordion.js >> >> The first line of accordion.js is >> >> $(document).ready(function() { >> >> >> Firebug displays >> $(document).ready is not a function >> >> >> I have read http://docs.jquery.com/Using_jQuery_with_Other_Libraries. This link is an explanation of how to resolve the conflict. >> >> >> >> To that end I have in a partial haml file >> >> (function($) { >> = javascript_include_tag ''accordion.js'' >> })(jQuery); >> >> >> The rendered output is >> (function($) { >> <script src="/assets/accordion.js?body=1" type="text/javascript"></script> >> })(jQuery); >> >> >> >> but I am still getting the >> $(document).ready is not a function >> error message. >> >> >> >> Is what I am trying to do even legal? >> >> -- >> 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. >>-- Best regards, Ralph mailto:ralphs-bVGy8FV858MAvxtiuMwx3w@public.gmane.org -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
a. It''s a filter, haml allows those. Docs here. http://haml-lang.com/docs/yardoc/file.HAML_REFERENCE.html#javascript-filter b. Sounds like you don''t know the basics of jQuery. By jquery listeners, ZS means the functions which listen to the DOM for any events, and handle them accordingly. Simply put, it''s the document.ready where you define your event handlers, or "jquery code" if you prefer. c. w3schools.com, jqfundamentals.com Dheeraj Kumar On Sunday 1 January 2012 at 10:26 PM, Ralph Shnelvar wrote:> Zachary, > > This is over my head. > > a) What does the :javascript do? Where is it documented? > > b) What''s a jquery listener? I have googled "jQuery listener" and a lot of stuff comes up. I need an introduction/overview. > > Speaking of which, is there a good introduction to javascript for programmers? Same for jQuery. > > Thanks! > > Ralph > > > Friday, December 30, 2011, 3:14:35 PM, you wrote: > > ZS> Put `= javascript_include_tag ''accordion.js''` outside your jquery listeners: > > ZS> _my_partial.haml > ZS> = javascript_include_tag ''accordion'' > ZS> :javascript > ZS> (function($) { > ZS> // jquery listeners here > ZS> })(jQuery); > > ZS> On Fri, Dec 30, 2011 at 2:21 PM, Ralph Shnelvar <ralphs-bVGy8FV858MAvxtiuMwx3w@public.gmane.org (mailto:ralphs-bVGy8FV858MAvxtiuMwx3w@public.gmane.org)> wrote: > > > I have a library conflict between jQuery.js & accordion.js > > > > > > The first line of accordion.js is > > > > > > $(document).ready(function() { > > > > > > > > > Firebug displays > > > $(document).ready is not a function > > > > > > > > > I have read http://docs.jquery.com/Using_jQuery_with_Other_Libraries. This link is an explanation of how to resolve the conflict. > > > > > > > > > > > > To that end I have in a partial haml file > > > > > > (function($) { > > > = javascript_include_tag ''accordion.js'' > > > })(jQuery); > > > > > > > > > The rendered output is > > > (function($) { > > > <script src="/assets/accordion.js?body=1" type="text/javascript"></script> > > > })(jQuery); > > > > > > > > > > > > but I am still getting the > > > $(document).ready is not a function > > > error message. > > > > > > > > > > > > Is what I am trying to do even legal? > > > > > > -- > > > 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-/JYPxA39Uh4Ykp1iOSErHA@public.gmane.orgm (mailto:rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org). > > > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org (mailto:rubyonrails-talk+unsubscribe-/JYPxA39Uh4Ykp1iOSErHA@public.gmane.orgm). > > > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > > > > > > > > > > > -- > Best regards, > Ralph mailto:ralphs-bVGy8FV858MAvxtiuMwx3w@public.gmane.org > > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org (mailto:rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org). > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com (mailto:rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org). > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.