【发布时间】:2017-10-21 22:16:14
【问题描述】:
当我点击“x”按钮时,我正在尝试从购物车(和本地存储)中删除一行。
这是我目前所拥有的:
for (i=0; i<numCart; i++){
var button = $('<td>'+infoCartItems[i].button+'</td>').addClass("checkoutTitles");
button.text('x');
row.append(button);
$(".cartTable").append(row);
}
这是我的存储代码:
var newItem= new Bun(pack, current, flavor2nd, flavor3rd, money);
var existingCartItems = JSON.parse(localStorage.getItem("itemsArray"))||[];
existingCartItems.push(newItem);
localStorage.setItem("itemsArray", JSON.stringify(existingCartItems));
【问题讨论】:
-
当前行为和预期行为是什么?
-
目前,当我点击“x”时没有任何反应
标签: javascript jquery local-storage shopping-cart