CoffeeScript links both this
and @
to the outer context, therefore you cannot access the context that jQuery provided (aka the desired “this”). Use event.target
instead:
class PostForm
constructor: ->
$('ul.tabs li').on 'click', (event) =>
tab = $(event.target)
@highlight_tab(tab)