adding extra fields to todo.js
-
25-10-2019 - |
문제
How do you add extra fields into todo.js?
initialize: function() {
this.input = this.$("#new-todo");
Todos.bind('add', this.addOne, this);
Todos.bind('reset', this.addAll, this);
Todos.bind('all', this.render, this);
Todos.fetch();
},
i think its the above code thats troubling, #new-todo is the div id where the text field is.
i add another 'this.input' with the id of the new field but it doesn't pick it up. how do i add additional elements?
해결책
I think this.$
only search beneath the element connected to the view. If you have your input element outside of the element the view is connected to, you can try to use just $("#another-todo")
or similar.
제휴하지 않습니다 StackOverflow