Learn localStorage by Building a Todo App - Step 6

Tell us what’s happening: I tried completing this step but I feel like maybe I’m not reading the instructions right. When I try checking my line of code below, I get a error message that says “Your event listener should include a callback function for the second argument using arrow syntax without curly braces. Then you should use the classList property and its toggle method on the taskForm, to toggle the class hidden.” Is there something that I’m missing here or reading wrong or maybe wrong syntax? the button works when I click on it.

Your code so far

openTaskFormBtn.addEventListener(“click” , () => taskForm.classList.toggle(“hidden”));

WARNING

The challenge seed code and/or your solution exceeded the maximum length we can port over from the challenge.

You will need to take an additional step here so the code you wrote presents in an easy to read format.

Please copy/paste all the editor code showing in the challenge from where you just linked.

const confirmCloseDialog = document.getElementById("confirm-close-dialog");
const openTaskFormBtn = document.getElementById("open-task-form-btn");
const closeTaskFormBtn = document.getElementById("close-task-form-btn");
const addOrUpdateTaskBtn = document.getElementById("add-or-update-task-btn");
const cancelBtn = document.getElementById("cancel-btn");
const discardBtn = document.getElementById("discard-btn");
const tasksContainer = document.getElementById("tasks-container");
const titleInput = document.getElementById("title-input");
const dateInput = document.getElementById("date-input");
const descriptionInput = document.getElementById("description-input");

const taskData = [];
let currentTask = {};

openTaskFormBtn.addEventListener("click" , () => taskForm.classList.toggle("hidden"));

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 6

I tried the exercise using the link you provided and it does indeed look like some sort of error on there unless I am missing something.

Is this all your code? I don’t see a defintion for taskForm.

no, this is not. I just noticed that I did not copy all of the code over but there is a definition for taskForm at the top of my code (which is the only line that was not included in post above)

Please show me that definition.

const taskForm = document.getElementById(“task-form”);

I have just spotted that you have a space in the line you added in step 6 that shouldn’t be there - can you spot it? If you can, remove it and this step should pass.

3 Likes

ahh I see it now. Thank you so much!

2 Likes

You’re very welcome :slight_smile:

3 Likes