title: Backbone event callback bind
body: <p>I am trying to bind a user defined callback as Backbone's click event.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var View = Backbone.View.extend({
      
      events: {
        'click': 'testClick'
      },
      
      tagName: "li",
      
      attributes: {
        class: "item"
      },
      
      initialize: function() {
        
          this.render();
        
      },
      
      testClick: function(){      
        
      },
      
      render: function() {
        
        $("#container").append(this.$el.html("Click Me!!"));
        
      }
      
    });
  
  function Item() {  
    
    var _view = View.extend({
      
      testClick: this.testClick.bind(this)
      
    });
    
    this.view = new _view();
    
  }
  
  Item.prototype = {
    
    testClick: function() {
      
      alert("testClick from prototype called!");
      
    }
    
  };
  
  
  var myItem = new Item();
  
  myItem.testClick = function() {
    alert("testClick from instance called!");
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;meta name="viewport" content="width=device-width"&gt;
    &lt;title&gt;JS Bin&lt;/title&gt;
    &lt;script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"&gt;&lt;/script&gt;
        &lt;script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.3.3/backbone-min.js"&gt;&lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
    &lt;div id="container"&gt;&lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Clicking on "Click me", it alerts "testClick from prototype called!"</p>
  
  <p>I am not sure why the alert from the instance is not getting called. What am I doing wrong here? Please help!</p>