I have included Javascript with <%= javascript_include_tag "application" %>
in my Rails 3.2 application. And, I have included the following CoffeeScript in the company.js.coffee file that is included in the final application.js file when run:
$("article h2 a").click (e) -> $("article div").hide() $(@hash).slideToggle() e.preventDefault() $("article div:not(#1)").hide()
However, the script doesn't work at all, despite functioning in the original HTML file that it was copied from (albeit not in CoffeeScript). And, similarly, the AJAX form requests don't seem to be working either.
Does anyone know why this may be occurring? Is there something I'm missing?