Created
April 15, 2012 19:09
-
-
Save dblack/2394369 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Update: I figured it out. I was loading the .js file twice. | |
In the view: | |
<%= link_to "Toggle comment", "#", :id => "toggle-comment" %> | |
<p id="comment" style="display:none;">Comment: <%= @scratchpad.comment %></p> | |
In the .js file: | |
$(document).ready(function() { | |
$("#toggle-comment").click(function() { | |
$("#comment").toggle('slow'); | |
}); | |
}); | |
Result: clicking on the "hide-comment" link fires off two toggle events, so the | |
"comment" element goes back to its original state. (I can tell because 'slow' | |
makes it very visible what's happening.) I can't figure out why this is happening. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment