0

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.

Deeptechtons
  • 10,945
  • 27
  • 96
  • 178
JeanFrancois
  • 134
  • 3
  • 7

1 Answers1

5

In a view class:

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

insertDiv: function(event) {
    this.$el.append("<div>...</div>");
}
Tanzeeb Khalili
  • 7,324
  • 2
  • 23
  • 27