I\'m using Backbone and therefore Underscore to render my templates. My templates get rendered in tags and then I use jQuery to grab their html. My
Most Backbone examples I've seen do it like this. This will only traverse the DOM once to parse the template when the page finishes loading and use that for each new ItemView()
.
App.ItemView = Backbone.View.extend({
template: _.template($("#ItemTemplate").html()),
className:'well',
events: {
'click .continue': 'handleContinueClick',
},
...
});
http://backbonejs.org/docs/todos.html#section-21