javascript - 使用 Backbone 的事件函数捕获超链接上的点击事件
问问题
4923 次
1 回答
3
您必须在视图中创建函数。
events: {
"click #expense-delete-button": "deleteRow",
"click #expense-copy-button": "copyRow",
},
deleteRow:function(e){
e.preventDefault();
//Element clicked on
var target = $(e.currentTarget);
console.log('whatever you want');
},
copyRow:function(e){
//Element clicked on
var target = $(e.currentTarget);
console.log('copy your row');
},
initialize:function(){
//view code....
}
于 2012-12-01T15:08:17.557 回答