title: How to bind an jQuery onclick event with Coffeescript, in Rails?
body: <p>I realise that I probably need to declare the onclick event globally, but I am trying to avoid using the <code>--bare</code> tag when compiling.</p>
  
  <p>This is the code I am trying to get working...</p>
  
  <pre><code>jQuery -&gt;
    $('.tabs_image').click -&gt;
      $(this).addClass('tabs_selected')
      $('.tabs_video').removeClass('tabs_selected')
      $('#image_upload_form').show()
      $('#video_upload_form').hide()
      return
  
    $('.tabs_video').click -&gt;
      $(this).addClass('tabs_selected')
      $('.tabs_image').removeClass('tabs_selected')
      $('#image_upload_form').hide()
      $('#video_upload_form').show()
      return
  
    return
  </code></pre>
  
  <p>It works fine once the page is hard refreshed (refresh clicked) in the browser Chrome.</p>
  
  <p>I have tried <code>$ =&gt;</code>, <code>$(document).ready -&gt;</code>, and <code>$(document).ready =&gt;</code>.</p>