I am creating an app in Backbone.js which has a parent and multiple child views. The child views contain links which they listen to and perform a function.
The parent stores a list of all of the children views. In the render function, after it is done computing its own html, it does the following:
$(this.el).html(html);
for (var i = 0; i < this.views.length; i++){
$('.children', this.el).append(this.views[i].render().el);
}
ANSWER: The problem was that I was creating the link during the render. I.e. on the first render (which was called from the init) the event successfully binded to the link. However, since all following calls of render recreate the whole element, the new link did not have the handler bound to it. This was solved via @Tom Tu solution of adding this.delegateEvents()
to the render