Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

109
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!