Learn localStorage by Building a Todo App - Step 38

Can anyone tell me what am i doing wrong it’s giving me the error You should use the remove() method to remove the parent element of buttonEl .

Your code so far

const deleteTask = (buttonEl) => {
  const dataArrIndex = taskData.findIndex(
    (item) => item.id === buttonEl.parentElement.id
  );
  buttonEl.parentNode.remove();
  taskData.splice(dataArrIndex, 1);
}

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Challenge Information:

Learn localStorage by Building a Todo App - Step 38

Hey @sulemankhalil44 welcome to the forum.You have used parentNode but you need to use parentElement

Happy coding!!

thanks for the answer i have already solved it.
happy coding

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