/*render is where we set each view's html*/
/*this.$el.html() means each unit will have a html of <b> xyz</b> no matter what I type*/
/*the console.log of $el here will yield Object{"0": {},"context": {}, "length": 1}*/
/*this.input will console log Object { length: 0, prevObject: {…}, context: li, selector: ".edit" }*/
/*this will console log-> cid: "view2", model: {…}, options: {…}, "$el": {…}, el: li, input: {…} */
/*the initialize and render parts execute each time you add a new one of these views*/
/*this.input is: Object { length: 0, prevObject: {…}, context: li*/
app.TodoView = Backbone.View.extend({
tagName: 'li',
template: _.template($('#item-template').html()),
render: function(){
this.$el.html("<b>xyz</b>");
/*adding this.$el.html("HELLO WORLD") would override the above...instead of <b>xyz</b> it will become HELLO WORLD*/
this.input = this.$('.edit');
return this; // enable chained calls
},
/*...*/