Continuous click on event

So, I have a Backbone view in which I declare its className. I am trying to bind a click event with this class. So something like this:

className: "question"
events:
    "click .question": -> console.log("clicked")

This does not work. It seems that the element is not inside the view itself. Therefore, if I create an element inside the template, I can snap to it just fine. Should I be able to directly attach to the performance itself? Any help is appreciated. Thank!

+3
source share
1 answer

From the exact guide :

delegateEvents delegateEvents([events])

[...] {"event selector": "callback"}. callback , . selector (this.el).

, , events :

events:
    'click': -> console.log('clicked')

: http://jsfiddle.net/6W6QE/

+7

All Articles