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

247
Views
Delete all completed items from list and update local storage

I am working on a to-do list project. I want to delete all those items at once which have lines through them by clicking the "clear all completed" button. when I check the box two things happen. First a class by name of "clicked" is added, which does text-decoration: line through. Secondly, It changes the completed boolean from false to true in local storage. you can check the picture below. I am trying to use the filter method, but, I am unsuccessful. Could anyone please help me, how to delete those items at once, along with removing them from local storage too, which have lines through them.

enter image description here

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I would save Completed as a boolean value instead of a string, but with your data as it currently stands, here's one way of doing it:

Example

const allTasks = localStorage.getItem('todo-list')
const incompleteTasks = allTasks.filter(task => task.Completed === "false")
localStorage.setItem('todo-list', activeTasks)
about 4 years ago · Juan Pablo Isaza Report
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!