Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

110
Visualizações
How to get values from chrome.storage in a forEach loop?

I am creating an extension that stores selected text in local and retrieves that value and prints it in an ongoing list. Each time the text is selected and added, it is added to the noteList.

    if(note.menuItemId === "addNote") {
        let noteText = note.selectionText       //noteText = selected note text
        chrome.storage.sync.set({'noteList': noteText})

Now this selected text has to be get from the local storage and printed in a list format in a way that everytime the user sets a new value a new listitem is created with that new text.

    let textArea = document.getElementById('textArea')     //textArea inside a list element

        chrome.storage.sync.get('noteList', function(updateNote){
        let noteListArray = new Array();
        list.innerHTML = '';
        textArea.value = String(updateNote.noteList)
        noteListArray.push(textArea.value)
        
        noteListArray.forEach(function(item){
            let list = document.createElement("list")
            let text = document.createTextNode(item)
            list.appendChild(text)
            document.getElementById("notesList").appendChild(list); 
        })

Now the problem is, I am not able to create a new list item. How should I proceed in this case.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda