Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top