Question

Can anybody give a small example about how to load a new div container based on a mouse click, using Backbone.js? I would like to add a new div container to my already existing html contents.

Was it helpful?

Solution

In a view class:

events: { "click #myButton": "insertDiv" }

insertDiv: function(event) {
    this.$el.append("<div>...</div>");
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top