0

Hi I wrote a code which has a working search with filters applied to it. The only problem I am having is that it doesn't stay the same as to how the filters where set when the user closes or refreshes the webpage. I am not using a checkbox

This is my code so far

saveTask: function(name, isCompleted) {
window.localStorage.setItem(name, isCompleted);
 },
 renderTasks: function() {
 for (var i = 0; i < window.localStorage.length; i++) {
  var taskName = window.localStorage.key(i);
  var isCompleted = window.localStorage.getItem(taskName) == "true";
  var taskHTML = Todo.template.replace("<!-- TASK_NAME -->", taskName);

  if (!isCompleted) {
    Todo.container.insertAdjacentHTML('afterbegin', taskHTML);
   }
  }
 }

This is a js fiddle https://jsfiddle.net/4p8awnqx/6/ I am trying to keep the filters the same using local storage so that when it is closed or refreshed it stays the same

cars
  • 318
  • 3
  • 11

0 Answers0