I know that I can use jQuery to access the view’s element in backbone.js by $(this.el), but what about accessing elements that are handled by backbone’s event binding?
How can I target the clicked div with id #button directly from my event handler, as shown below? Do i really need to create a subview for this?
Backbone.View.extend({
el : "#container",
events: {
'click #button' : 'buttonHandler'
},
buttonHandler: function(e) {
// $(this.el)... works as supposed but what about $(my button)?
}
}
1 Answer