0

This is my function:

function render() {
  let list = document.getElementById('myNotes');
  trashFolderModal = document.getElementById('allBlur');
  list.innerHTML = localStorage.setItem(key, text);

  for (let i = 0; i < titles.length; i++) {
    const title = titles[i];
    const note = notes[i];
    list.innerHTML += card(title, note, i);
  }
}

And here is my Note Website (you can see the source code): http://patrick-sterz.developerakademie.com/Notizblock2/index%282%29.html

1 Answers1

0

setItem returns undefined.

I suspect you need to revisit what you want to do.

Normally we do this when the list changes

 localStorage.setItem("list",JSON.stringify(myListArray));

and when we load the page we do a

let listContent = localStorage.getItem("list"); 
let myListArray =  listContent ? JSON.parse(listContent) : [];
mplungjan
  • 169,008
  • 28
  • 173
  • 236
  • Hi thanks for the answer, i need getItem not setItem, but please give me the exact code/function because I've been stuck on this task for 3 hours – Patrick Sterz Feb 07 '22 at 10:54
  • I would need at least one hour to fix your script. It is FAR too unnecessarily complex. Have two arrays - I have started here, but need to go. https://jsfiddle.net/mplungjan/ywnh7058/ – mplungjan Feb 07 '22 at 11:08
  • Ok thank you so musch, i am a begiiner and cant understand your code. I do it with my own code. But thank you, you are the best – Patrick Sterz Feb 07 '22 at 19:22