The Render function only adds an HTML string that has no related events. Instead, add the HTML element (just remove the part .html()):
events: {
'click' : 'move'
},
render: function(event) {
this.$el.append('<button type="button" value="Submit"></button>');
$("#standard-input-form").html(this.$el);
return this;
},
, click . - MovePalletView #standard-input-form this.$el:
var MovePalletView = Backbone.View.extend({
el: '#standard-input-form',
initialize: function () {},
events: {
'submit': 'move'
},
render: function (event) {
this.$el.append('<button type="submit" value="Submit"></button>');
return this;
},
move: function (e) {
e.preventDefault();
alert("You clicked it");
}
});
. , , type="submit", onsubmit. View (el: '#standard-input-form'). onsubmit.