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

220
Views
Unable to delete item from the list using javascript

I'm trying to build an chrome extension, where I am trying to delete an item from the list and also localStorage, whenever a deleteBtn corresponding to that item is clicked, but somehow if block doesn't seem to be working, and i'm not able to figure out why. Need help

code:

function deleteTask(){
        const deleteBtn = document.querySelectorAll(".delete");

        deleteBtn.forEach((item)=>{
            item.addEventListener("click",()=>{
                for(let i=0; i<localStorage.length; i++){
                    let key = localStorage.key(i);
                    let value = localStorage.getItem(key);
                    if(item.parentElement.parentElement.innerText == value){
                        localStorage.removeItem(key);
                        item.parentElement.parentElement.remove();
                    }
                }
            })
        })
    }

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!