link_to_function toggle problem - Ruby on Rails
Posted
by bgadoci
on Stack Overflow
See other posts from Stack Overflow
or by bgadoci
Published on 2010-05-09T06:50:50Z
Indexed on
2010/05/09
6:58 UTC
Read the original article
Hit count: 515
I asked this question back in November and everything seemed to work just fine. I am recently trying to implement it again and running into a problem. I am not receiving any error message, just can't get the toggle to work. Using Rails 2.3.5 and Ruby 1.8.7. See anything wrong here?
View
<%= javascript_include_tag :defaults %>
<div id="comment-toggle">
<%= link_to_function "toggle", "$('comments_#{project.id}').toggle()" %>
</div>
<div id="comments_<%= project.id %>" class="comments" >
<%= render :partial => project.comments %>
<% remote_form_for [project, Comment.new] do |f| %>
<p>
<%= f.label :body, "New Comment" %><br/>
<%= f.text_area (:body, :class => "textarea") %>
</p>
<p>
<%= f.label :name, "Name" %> (Required)<br/>
<%= f.text_field (:name, :class => "textfield") %>
</p>
<p>
<%= f.label :email, "Email" %> (Required but will not be displayed)<br/>
<%= f.text_field (:email, :class => "textfield") %>
</p>
<p><%= f.submit "Add Comment" %></p>
<% end %>
</div>
© Stack Overflow or respective owner