I'm forced to use Backbone at work though my knowledge is still very limited.
I'm having troubles understanding "this" element - here's an example:
Normally, this would be a piece of jQuery code:
$('.birds').click(function() {
$(this).fadeOut();
});
What I would like to achieve is when clicking on one element among many with the same class (.birds for example) to be able to perform an action on this specific, clicked element.
I see though that "this" is used very often in the view and I don't even know where to start to make "this" my "this".
I would appreciate a short explanation about what is THIS about in Backbone.
EDIT:
Thank you for the links, I'll read about it. In the meantime - assuming this structure:
events: {
'click .birds' : 'birdsFunction'
},
birdsFunction: {
$(this).fadeOut();
}
Is it correctly written or what I consider "this" (the clicked element with .birds class) is not MY "this"?