I want to listen to event/s in my View, but only after some processing (to be specific, I only what to respond to these events after a successful ajax call - that is all working, it's just this event stuff I can't figure).
Because of this, using the events property isn't going to achieve what I'm after.
I'm new to backbone and am at a loss as to what the problem is with my this.on('click'...) code below (backboneClicked() does not fire).
I have included the events property below as I put this in to test and it fires ourClick(). jqueryClicked() also fires.
Am I missing something really obvious?
I know there are lots of other questions about views not firing events, but I couldn't see anything that matched this question.
Any help appreciated.
var InputListView = Backbone.View.extend({
el: '#input-list',
events: {
'click input' : 'ourClick'
},
initialize: function(options) {
this.$el.click(this.jqueryClicked);
this.on('click', this.backboneClicked);
},
ourClick: function(e) {
alert('ourClick');
},
backboneClicked: function(e) {
alert('backboneClicked');
},
jqueryClicked: function(e) {
alert('jqueryClicked');
}
});