Learn localStorage by Building a Todo App - Step 6

Tell us what’s happening:

The toggle method will add the class if it is not present on the element, and remove the class if it is present on the element.

element.classList.toggle(“class-to-toggle”);
Add an event listener to the openTaskFormBtn element and pass in a click event for the first argument and an empty callback function for the second argument.

For the callback function, use the classList.toggle() method to toggle the hidden class on the taskForm element.

Now you can click on the “Add new Task” button and see the form modal.

Your code so far

openTaskFormBtn.addEventListener('click', function() {
    taskForm.classList.toggle('hidden');
});

Blockquote

why the tf this isnt working ???

Your browser information:

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

Challenge Information:

Learn localStorage by Building a Todo App - Step 6

1 Like

Fcc test probably want you to use Arrow function as your callback function in addEventListener.

() => {}

More arrow function example here . JavaScript Arrow Function

2 Likes

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