I am trying to use jQuery with CoffeScript. I was following the instructions form a blog which indicated to use $ -> or jQuery -> instead of .ready() . I played around with the code a bit but I can’t seem to understand what I am getting wrong. Just trying to learn a little bit.
Here is the code that works in jQuery:
$(document).ready( function() {
$("span.today").closest("td").css("background-color", "#7792ad")
});
Here is what I was expecting to work in CoffeScript:
$ ->
$("span.today").closest("td").css("background-color", "#7792ad")
It doesn’t work though.
Try this: