Backbone.js accessing elements which fired a View's event [duplicate]
I need to access some information about the element that was bound to a Backbone View's events (i.e. the href="something"). How do I access this object?
var SomeView = Backbone.View.extend({
    e开发者_如何转开发vents: {
        "click a.some-class": "doStuff"
    }
    doStuff: function(e) {
        e.preventDefault(); // prevent default behavior
        // How can I access the element (i.e. a <a>) here?
    }
});
$(e.target) will work.
doStuff: function(e) {
   e.preventDefault();
   $(e.target).css('color', 'red');
 }
See http://jsfiddle.net/aD3Mn/2/
 
         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论