var theView = Backbone.View.extend({
initialize: function() {
this.render();
},
render: function() {
var template = _.template($("#ourTemplate").html(),{});
this.$el.html(template);
}
});
jQuery(document).ready(function($) {
var page = new theView({el: $("#div1")});
});
<!DOCTYPE html>
<html>
<head>
<title>Backbone Example</title>
<link rel="stylesheet" href="lib\css\todos.css" />
<script src="lib/js/jquery-1.9.1.js"></script>
<script src="lib/js/underscore.js"></script>
<script src="lib/js/backbone.js"></script>
<script src="app.js"></script>
<script type="text/template" id="ourTemplate">
<h1>Hello 1</h1>
<h2>Hello 2</h2>
<p>Lorem ipsum dolor sit amet, consectetur adip</p>
</script>
</head>
<body>
<div id="div1"></div>
</body>
</html>