On 19 Jan 2009, at 09:27, Shilo Ayalon wrote:

>
> I tried following Ryan Bates' railscast on rjs tips
> (http://railscasts.com/episodes/45-rjs-tips) and apply his method of
> using if-else inside the rjs template, but can't seem to get it to  
> work.
> Basically, I'm trying to toggle the text on a link when it's clicked
> (test.js.rjs):
>
> page << "if ($('test_link').value == 'one' {"
> page.replace_html 'test_link', 'two'
> page << "} else {"
> page.replace_html 'test_link', 'one'
> page << "}"


Syntax error - does not compute.

Look closely and see how you forgot the ")" after "'one'". Javascript  
is very punctuation sensitive, you need to pay special attention to  
it. Also, use Firefox for testing and install Firebug to debug your  
javascript. It would have indicated this error.


Best regards

Peter De Berdt


--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to