Answer the question
In order to leave comments, you need to log in
How to make a selection from an object?
It is necessary to add one element to "localstorage", let's say "{2021:1}" , but not all at once.
var items = { 2021: 0, 2022: 0, 2023: 0, 2024: 0 };
out1 += '<button class="number" data-art="' + key + '">' + items[key] + '</button>';
function plus() {
var articul = $(this).attr('data-art');
if (cart[articul] != undefined) {
cart[articul]++;
}
else {
cart2[articul] = 1;
}
localStorage.setItem('cart', JSON.stringify(cart));
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question