I've a div like this in a scala.html file of my template (I'm using PlayFramework):
<div id="box">Text in the box</div>
and this Coffee script:
$("#box").on "click", ->
$("#box").fadeOut()
It doesn't work: if I click the div #box nothing happens.
I'm trying to use plain jquery to understand if it's a Coffee issue or not. Then I put the same jQuery script in <head>:
<script>
$("#box").on("click", function() {
return $("#box").fadeOut();
});
</script>
and doesn't work again but if I put it in the scala.html file (that contains the div #box) it works! Where is the error?
$(document).ready(function() {.... No errors in console.$(document).on 'click', '#box', -> ...