title: How to hide and show a div with coffeescript - Rails 3.1
body: <p>I am trying to make a similar behavior as the comment link on a question in Stack Overflow.
  A click should hide the div containing the "Add comment" link and show another div containing the form for a new comment.</p>
  
  <p>How is it possible to do that with coffeescript ?</p>
  
  <p>I am trying the following that does not work : </p>
  
  <pre><code>jQuery -&gt;
  
    hide_comment_link = () -&gt;
      $('#add_comment_link').hide
    hide_comment = () -&gt;
      $('#add_comment').hide
    show_comment = () -&gt;
      $('#add_comment').show
  
    $('#add_comment_link').click -&gt;
      hide_comment_link
      show_comment
      false
  </code></pre>
  
  <p>View is : </p>
  
  <pre><code>#add_comment_link
    #{link_to "Add a comment"}
  #add_comment
    Add a comment in this div.
  </code></pre>