Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Backbone View Event

/*the left side is what we really are doing in this "template"..like in dblclick label in this template, we will call this event edit*/
/*the right side what we will call it...our 'fake event name'*/
    app.TodoView = Backbone.View.extend({
      tagName: 'li',
      template: _.template($('#item-template').html()),
   /*******/
      events: {
        'dblclick label' : 'edit',
        'keypress .edit' : 'updateOnEnter',
        'blur .edit' : 'close',
        'click .toggle': 'toggleCompleted',
        'click .destroy': 'destroy'
      },
 
PREVIOUS NEXT
Tagged: #Backbone #View #Event
ADD COMMENT
Topic
Name
7+2 =