backbone js event listener

JavaScript
const element = document.querySelector(".class__name");

element.addEventListener("click", () => {
	console.log("clicked element");
});// There are quite a few abstracted versions of the following
$('element').on('event', function() {
	// Do something
});

// Where 'event' is something such as 'click', 'hover' etc

// They are abstracted as seen below
$('element').click(function(){
	// Do something
});
$('element').hover(function(){
	// Do something
});

// etc...var ViewName = Backbone.View.extend({  
   initialize: function(){  
      this.$el.on("eventName", this.functionName, this)  
   },  
   functionName: function(){  
    //whatever  
   }  
});var ViewName = Backbone.View.extend({  
   initialize: function(){  
      this.$el.on("eventName", this.functionName, this)  
   },  
   functionName: function(){  
    //whatever  
   },
   remove: function() {
      this.$el.off("eventName", this.functionName);
      Backbone.View.prototype.remove.apply(this, arguments);
   }  
});
Source

Also in JavaScript: