So I have a Backbone view in which I declare it’s className. I’m trying to bind a click event to that class. So something like this:
className: "question"
events:
"click .question": -> console.log("clicked")
This doesn’t seem to work. It seems to be because the element isn’t inside the view itself. So if I create an element within a template, I can bind to that just fine. I should be able to bind to the view itself right? Any help is appreciated. Thanks!
From the fine manual:
So you want your
eventsto look like this:Demo: http://jsfiddle.net/6W6QE/