Ruby on Rails Wednesday, September 1, 2010

Edmond, Thanks for the response. It helped set me in the right
direction! Left some code out in the previous post, so this is what i
did...


I put this in the show.html.erb:

---------------------------------
<div id="response_a">
<%= "#{@formatted_question[:response_a]}" %>
</div>

<div id="response_b">
<%= "#{@formatted_question[:response_b]}" %>
</div>


<a href="#" onclick="Element.toggle('response_a')">A</a>
<a href="#" onclick="Element.toggle('response_b')">B</a>
---------------------------------


and this in the .css:

---------------------------------
#response_a {display: none}
#response_b {display: none}#response_c {display: none}
---------------------------------


Only problem is it only toggles if I change 'display: none' to 'display:
""'. And then it doesn't hide the responses when the page initially
renders, which I need it to do. Any ideas??

Thanks again,
Dave

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

No comments:

Post a Comment