I've forked your jsfiddle and updated it. Here is the working jsfiddle.
Issue is in this statement:
var productBookView = new ProductBookView({
el: $('.product-view')
});
You need to update it with:
var productBookView = new ProductBookView({
el: $('.product-view:last')
});
Reason is, the el
element of ProductBookView
should be last .product-view
. In the code provided by you el
is assigned all div
elements existing in the DOM having class by name product-view
. Hence every time you add a new product, all div elements with class name product-view
is updated with product_book_template
html. Hence the input box gets cleared off.