I am trying to do what seems like it should be simple, but for some reason is eluding me. I want to add a click event to a link in my tasks.js file like so:
$ ->
$('.cancel_task').click ->
$('#task_form').toggle
This renders out as:
(function() {
$(function() {
return $('.cancel_task').click(function() {
return $('#task_form').toggle;
});
});
}).call(this);
All I want is something like:
$('.cancel_task').click(function()
{
$('#task_form').toggle();
});
How do i accomplish this with coffescript and the rails 3.1 stack?