Following this tutorial went okay but I decided to give it another run with backbone 0.9 and the new setElement command.
<script type="text/javascript" id = "test" >
SearchView = Backbone.View.extend({
initialize: function(){
this.render();
},
render: function(){
var template = _.template( $("#search_template").html(), {} );
//Right here
this.setElement( template );
},
events: {
"click input[type=button]": "doSearch"
},
alert( "Search for " + $("#search_input").val() );
}
});
var search_view = new SearchView({ el: $("#search_container") });
</script>
Previously, I used this.el.html(template)
, but how do I use the new setElement command?
What I have there currently doesn't work, the search field that should appear does not.