I have a list populated from a local storage array.
I have a code that deletes an item from the list when clicked. It worked fine until I added dividers. The reason is that the list index gets reset after each divider. Is there a unique list index or some other way to uniquely identify the list item clicked?
This is the code that used to work, now it deletes randomly
cart is a local object that holds cart_item array
var a = [$(this).index()];
Code: Select all
var cart = Apperyio.storage.cart.get() || [];
cart.splice(a,1);
Apperyio.storage.cart.set(cart); .