How can i append a view to existing html markup using backbone.js
-
12-12-2019 - |
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.
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