window.addEventListener("load", function () {
document.getElementById("btnList").addEventListener("click", function () {
localforage.iterate((value, key, iterNum) => {
const lisst = [key, value]
document.getElementById('jstext').innerText = lisst
console.log(lisst) //log shows all of the added items
//but lisst.length === 2
//what am I missing?
});
}
<button id="btnList">List Values</button>
<div id="jstext">
</div>
Hello! What I am attempting to do here is display all of the different items that have been added to my localforage list. When I log to console, all of the items that have been added are displayed in console, but when I attempt to display the entire list in my <div> element, or even a <p> element, only ONE item (the last item entered) shows up on the webpage in the element.
So my question is: How do I display every item in my HTML element, and where am I going wrong that I am only showing the most recently entered item to localforage?