Learn localStorage by Building a Todo App - Step 9

Tell us what’s happening:

Task:

Add a click event listener to discardBtn , then use the close() method on the confirmCloseDialog variable. Also, use classList to toggle the class hidden on taskForm so the form modal will close too.

Feedback on trying to submit my code:

Your event listener should use classList to toggle the class hidden on taskForm .

Your code so far

discardBtn.addEventListener("click", () => {
    confirmCloseDialog.close();
    taskForm.classList.toggle("hidden")
    }
  )

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36

Challenge Information:

Learn localStorage by Building a Todo App - Step 9
[https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-localstorage-by-building-a-todo-app/step-9](https://Link to challenge)

It looks like your code is on the right track, but there might be a small issue with the event listener. Ensure that the taskForm variable is correctly referencing the form modal element. Also, make sure that the hidden class is applied to hide the modal.

Here’s the corrected code:

javascriptCopy code

Mod Edit SOLUTION REMOVED

Make sure to replace "discardBtn", confirmCloseDialog, and taskForm with the actual IDs or references in your HTML.

If you’re still facing issues, double-check the console for any error messages that might give you more information on what’s going wrong.

Solution was probably a bug…

Had to put the last } and ) on the same line…

most likely a bug. It did the same thing to me