如何在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();
},

我认为这是令人不安的上述代码,#new-todo是文本字段所在的DIV ID。

我在新字段的ID中添加了另一个“ this.ut”,但它不会拾取它。如何添加其他元素?

有帮助吗?

解决方案

我认为 this.$ 仅在连接到视图的元素下方搜索。如果您的输入元素在元素之外,视图已连接到,则可以尝试使用 $("#another-todo") 或类似。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top