Backbone.js Event listenTo()

The Backbone.js Event listenTo method tells an object to listen to a particular event on another object. It provides callback function when an event occurs and also keeps track of events.

Syntax:

Parameter explanation:

other: It is used to define the name of the other object.

event: It is used to bind an object.

callback: It is reference to the code and called with object as context.

Let's take an example.

See this example:

Test it Now

Output:

Save the above code in listento.html file and open this file in a browser.

BackboneJS Event listenTo Method



Latest Courses