tried chapgbpt and it matched my code still give me this eroor
my code:
openTaskFormBtn.addEventListener(“click”, function() {
taskForm.classList.toggle(“hidden”);
});
Step 6
Now, you will work on opening and closing the form modal.
In earlier projects, you learned how to add and remove classes from an element with el.classList.add()
and el.classList.remove()
. Another method to use with the classList
property is the toggle
method.
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.
Challenge Information:
Learn localStorage by Building a Todo App - Step 6