I’m just starting to learn backbone.js. I’m following this tutorial here at backbonetutorials.com, but for some reason I’m not being able to put it working. Here’s what I’ve got so far (fiddle):
var View = Backbone.View.extend({
el: $('.container'),
initialize: function() {
this.render();
},
render: function() {
var templ = _.template($('#template').html(), {});
this.el.html(templ);
},
events: {
"click button": "buttonClick"
},
buttonClick: function() {
alert('clicked!');
}
});
var view = new View();
What’s wrong with the above? I’ve almost just copy/pasted from the tutorial to the fiddle. Is it related to the backbone/underscore versions being used?
Thanks in advance.
try
instead of
http://jsfiddle.net/eykKL/4/