Learn localStorage by Building a Todo App - Step 18

Could someone please point out what’s wrong with my code?
I keep getting the same error message " You should create a div element with the class task ."

Step 18

Create a div element with the class of task. Utilize template strings to set the id attribute of the div to the id you destructured from the task data.

taskData.forEach(({id, title, date, description}) => {
      (tasksContainer.innerHTML += ``);
    const div = document.createElement('div');
    taskDiv.className = 'task';
    taskDiv.id = `task-${id}`;        
 });
});

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36

Challenge Information:

Learn localStorage by Building a Todo App - Step 18

I had just figured mine out and didn’t need to use the createElement, or class name. I made mine look like normal HTML example:

, and also note that it’s to be in the tasksContainer ticks.

You need to add the class to div instead of taskdiv because div is the new div you created.

 <div class="task" id="${id}"></div>

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.