There is a lot of value in my local store and I want to delete some of them. When I click on the dynamic card I created, it should be deleted both normally and locally. I can normally delete it but I can not delete it from local.
The local storage event is very confusing and does not have a lot of explanatory resources. at least i could not find it. Thank you for your help already.
$('#field').keypress(function (e) { if (e.keyCode === 13 && !e.shiftKey) { e.preventDefault(); if ($('#field').val() === '') return false; let comment = { card: $('#field').val(), id: generateGUID() }; $('#field').val('') var store = JSON.parse(localStorage.getItem('todo')) || []; store.push(comment); localStorage.setItem('todo', JSON.stringify(store)); $(this).val(''); displayComment(comment); } }); function displayComment(comment) { var html = $(`<div class="card" data-id="${comment.id}"><h5>${comment.card}</h5></div>`); $('.yorum').append(html); $('.yorum').find(html).click(function () { $(html).remove(); }); } var store = JSON.parse(localStorage.getItem('todo')) || []; store.forEach(displayComment);