The array automatically delegates events to the view element. As is the case, el in your TaskView points to an unattached div (by default, el created by Backbone), not an item in your list.
The cure is simple: create a subheading with its e-grid to the correct DOM node, setting tagName to li and adding this element to your main view.
var TaskView = Backbone.View.extend({ tagName: 'li', events: { 'click a.fire': 'fire' }, fire: function() { alert('fire'); }, initialize: function() { this.template = _.template($('#view-template-new-task').html()); }, render: function() { this.$el.html(this.template()); return this; } }); var View = Backbone.View.extend({ events: { 'click button.add': 'addView' }, addView: function(e) { var task = new TaskView(); this.$('#tasks').append(task.render().el); } });
And the updated Fiddle http://jsfiddle.net/BLP6J/31/
source share