title: CoffeeScript - Binding Click Events to Dynamically Loaded Objects With JQuery On
body: <p>Working on rewriting the front-end of my site in Coffeescript. I understand how to bind a click function to a class.</p>
  
  <pre><code>$('.song').click -&gt;
      //code
  </code></pre>
  
  <p>However, I am running into some problems with dynamically loaded content. I know in JQuery, the solution to this would be to use the "On" function like so:</p>
  
  <pre><code>$(document).on('click', '.song', function(){
      //code
  });
  </code></pre>
  
  <p>But I am unsure on how this translates to coffeescript. I am under the impression that the rocket arrow -> translates to an anonymous function in javascript, but how does that work with if the function is one of the parameters? I've tried out quite a few different syntax and none of them seem to work, thanks!</p>