{ Josh Rendek }

<3 Ruby & Go

When defining a event listener for objects in Coffeescript you nede to make sure you use a -> – using a => will result in any references to attr() be “undefined”

Here is an example of some correct on click bindings that use the attr() methods

1   jQuery ($) ->
2   $('[id^=story_]').click ->
3     $( "#" +  $(this).attr("id") + "_loader")
4       .load('/projects/' + $(this).attr('project_id') +
5       '/story_types/' + $(this).attr('story_type_id') +
6       '/stories/'+ $(this).attr('story_id') + '/tasks/new')
comments powered by Disqus