Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

117
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda