CoffeeScript: How to use both fat arrow and this?

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)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)