I am a newer for backbone. There is a link for my code.
$(function (){
var test = {};
test.View = Backbone.View.extend({
el: 'body',
initialize: function (){
this.input = $('#new-todo');
},
events: {
'keyup #new-todo': 'check'
},
check: function (){
console.log('!');
$('#test').html(this.input.val());
}
});
test.view = new test.View();
});
I found a similar question but still confused it.When I set el:'#container'
the keyup
event doesn't work.
I want to know, what is it the View.el
, what's is that its function? What's the different from el: 'body'
and el: '#container'
.