Question

Comment ajouter des champs supplémentaires dans 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();
},

Je pense que thats code ci-dessus troublant, # nouveau-todo est le div id où le champ de texte est.

i ajouter une autre « this.input » avec l'identifiant du nouveau champ, mais il ne le ramassez pas. comment je fais ajouter des éléments supplémentaires?

Était-ce utile?

La 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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top