The code:
var Appointment = Backbone.Model.extend({});
var appointment = new Appointment();
appointment.set('title', 'My knee hurts');
var AppointmentView = Backbone.View.extend({
render: function(){
$(this.el).html('<li>' + this.model.get('title') + '</li>');
}
});
Question about that: $(this.el)…
looks like “this” is “window” object and not event object?
Please if you can expain deeply how it working.
Thanks,
Yosef
In backbone.js views the
thisis bound to the view object, not the window. You can access the event object if needed and through there get a reference to the target element. Have a look at this question for some more information.