dlr*_*ust 4 javascript backbone.js
我需要访问有关绑定到Backbone View事件(即href="something")的元素的一些信息.我如何访问此对象?
var SomeView = Backbone.View.extend({
events: {
"click a.some-class": "doStuff"
}
doStuff: function(e) {
e.preventDefault(); // prevent default behavior
// How can I access the element (i.e. a <a>) here?
}
});
Run Code Online (Sandbox Code Playgroud)
Sam*_*lan 14
$(e.target) 将工作.
doStuff: function(e) {
e.preventDefault();
$(e.target).css('color', 'red');
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2720 次 |
| 最近记录: |