hi! I must miss something really essential that the following doesnt work: I have a haml layout which includes the default javascripts, and the application.js looks like this: $("foobar").addClassName(''blue''); the view looks like this: <div id="foobar" class="green">testtest</div> if I navigate to the site, I get the error "$("foobar") has no properties". I am using rails 2.0.2 and prototype 1.5.0 please help me I''m despairing. flo schaf --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Is your call to addClassName above or below the div foobar in the final source order? If above, wrap it in a dom:loaded listener, so you can be sure that the object in question is on the page at the moment that the script is run. document.observe(''dom:loaded'',function(){ //your script goes here }); Walter On Mar 19, 2008, at 6:59 AM, schaf88 wrote:> > hi! > I must miss something really essential that the following doesnt work: > I have a haml layout which includes the default javascripts, and the > application.js looks like this: > > $("foobar").addClassName(''blue''); > > the view looks like this: > <div id="foobar" class="green">testtest</div> > > if I navigate to the site, I get the error "$("foobar") has no > properties". > I am using rails 2.0.2 and prototype 1.5.0 > please help me I''m despairing. > > flo schaf > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
thank you, I already thought of something like this. my application.js now looks like this: document.observe("dom:loaded", function() { $("foobar").addClassName(''blue''); }); but now I get "document.observe is not a function". prototype.js is included before application.js On 19 Mrz., 13:18, Walter Lee Davis <wa...-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote:> Is your call to addClassName above or below the div foobar in the > final source order? If above, wrap it in a dom:loaded listener, so > you can be sure that the object in question is on the page at the > moment that the script is run. > > document.observe(''dom:loaded'',function(){ > //your script goes here > > }); > > Walter > > On Mar 19, 2008, at 6:59 AM, schaf88 wrote: > > > > > hi! > > I must miss something really essential that the following doesnt work: > > I have a haml layout which includes the default javascripts, and the > > application.js looks like this: > > > $("foobar").addClassName(''blue''); > > > the view looks like this: > > <div id="foobar" class="green">testtest</div> > > > if I navigate to the site, I get the error "$("foobar") has no > > properties". > > I am using rails 2.0.2 and prototype 1.5.0 > > please help me I''m despairing. > > > flo schaf--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
What version of Prototype are you using? document.observe is for 1.6+ For 1.5x and previous, use this: Event.observe(window,''load'',function(){ ... }); Walter On Mar 19, 2008, at 12:02 PM, schaf88 wrote:> > thank you, I already thought of something like this. > my application.js now looks like this: > > document.observe("dom:loaded", function() { > $("foobar").addClassName(''blue''); > }); > > but now I get "document.observe is not a function". prototype.js is > included before application.js > > On 19 Mrz., 13:18, Walter Lee Davis <wa...-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote: >> Is your call to addClassName above or below the div foobar in the >> final source order? If above, wrap it in a dom:loaded listener, so >> you can be sure that the object in question is on the page at the >> moment that the script is run. >> >> document.observe(''dom:loaded'',function(){ >> //your script goes here >> >> }); >> >> Walter >> >> On Mar 19, 2008, at 6:59 AM, schaf88 wrote: >> >> >> >>> hi! >>> I must miss something really essential that the following doesnt >>> work: >>> I have a haml layout which includes the default javascripts, and the >>> application.js looks like this: >> >>> $("foobar").addClassName(''blue''); >> >>> the view looks like this: >>> <div id="foobar" class="green">testtest</div> >> >>> if I navigate to the site, I get the error "$("foobar") has no >>> properties". >>> I am using rails 2.0.2 and prototype 1.5.0 >>> please help me I''m despairing. >> >>> flo schaf > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
I just saw it in the documentation, thank you. I upgraded to version 1.6 and it works fine now. On 19 Mrz., 17:06, Walter Lee Davis <wa...-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote:> What version of Prototype are you using? document.observe is for 1.6+ > For 1.5x and previous, use this: > > Event.observe(window,''load'',function(){ ... }); > > Walter > > On Mar 19, 2008, at 12:02 PM, schaf88 wrote: > > > > > thank you, I already thought of something like this. > > my application.js now looks like this: > > > document.observe("dom:loaded", function() { > > $("foobar").addClassName(''blue''); > > }); > > > but now I get "document.observe is not a function". prototype.js is > > included before application.js > > > On 19 Mrz., 13:18, Walter Lee Davis <wa...-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote: > >> Is your call to addClassName above or below the div foobar in the > >> final source order? If above, wrap it in a dom:loaded listener, so > >> you can be sure that the object in question is on the page at the > >> moment that the script is run. > > >> document.observe(''dom:loaded'',function(){ > >> //your script goes here > > >> }); > > >> Walter > > >> On Mar 19, 2008, at 6:59 AM, schaf88 wrote: > > >>> hi! > >>> I must miss something really essential that the following doesnt > >>> work: > >>> I have a haml layout which includes the default javascripts, and the > >>> application.js looks like this: > > >>> $("foobar").addClassName(''blue''); > > >>> the view looks like this: > >>> <div id="foobar" class="green">testtest</div> > > >>> if I navigate to the site, I get the error "$("foobar") has no > >>> properties". > >>> I am using rails 2.0.2 and prototype 1.5.0 > >>> please help me I''m despairing. > > >>> flo schaf--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Reasonably Related Threads
- (Noob) Image upload: rename file
- one db - many rails projects -> many schema_migrations table
- Rails Plugins: How to copy artefacts to the public directory during install? When is install.rb executed anyway?
- Trouble with trusted domains
- Element.observe () binding