When we link the event directly to the item, the browser creates an event for each item. However, we can delegate the event to other elements. Usually, this element can be the document or the parent of the element. In this case, we are going to delegate it to the document that is the event for adding or removing one unit from a product. The problem is that if we just define one event manager for all the products, how do we set the product we are managing? KnockoutJS gives us some useful methods to succeed in this,
We should update the
cart-item.htmlfile's add and remove buttons by adding the
<span class="input-group-addon"> <div class="btn-group-vertical"> <button class="btn btn-default btn-xs add-unit"> <i class...