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 << "}" I believe I have the necessary view and controller code: <%= link_to_remote 'one', :url => { :action => 'test' } %> and def test respond_to do |format| format.js end end -- 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@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 -~----------~----~----~----~------~----~------~--~---