使用 jQuery 和backbone.js,我想尽可能地将JavaScript 与HTML 分开。
是否可以custom attribute
在 JavaScript 和 HTML 之间添加一个更好的分离?那么我该如何使用新的 jQuery 选择器呢?
例子:
<input type="text" id="todo-input" class="todo-input" tid="tid-attribute" > hello world </input>
// The DOM events
// I would like to use another selector tid and not class or id
events: {
"keypress #todo-input" : "updateOnEnter" // I would like to use another selector tid not id,
"keypress .todo-input" : "updateOnEnter" // I would like to use another selector tid and not class
}