title: Need help on link_to with on click event ruby on rails 4.2.6
body: <p>I'm new to Rails. If anyone could help me convert this code into a ruby link_to method:</p>
  
  <pre><code>&lt;a href="#top" onclick=$("#menu-close").click();&gt;Home&lt;/a&gt;
  </code></pre>
  
  <p>I tried to search google for an answer. But it made me more confuse on how to implement it on my site.</p>
  
  <pre><code>&lt;%= link_to "Home" , {:action =&gt; "index", :controller =&gt; "welcome", :anchor =&gt; "top", :onclick =&gt; '$("#menu-close").click()' } %&gt; 
  </code></pre>
  
  <p>but still it does not close the sidebar. </p>
  
  <p>Here is also the script I put below the footer : </p>
  
  <pre><code>$("#menu-close").click(function(e) { 
    e.preventDefault(); 
    $("#sidebar-wrapper").toggleClass("active"); 
  });
  </code></pre>