I'm trying to call view function in when clicking a button, I found this question and followed but still not reach the view function.
Html:
<form class="addToCart-form">
<input type="button" id="addToCart" class="addToCart" value="Add To Cart" />
</form>
View :
var CartView = Backbone.View.extend({
events : {
"click : #addToCart" : "addToCart"
},
addToCart : function (){
console.log('saved');
return false;
},
render: function(){
$("#list").html("string");
$("#rightpanel").html("another string");
}
});
I tried console.log
in my router
and render()
are working, except in addToCart
function.
Any help would be appreciated.