Learn localStorage by Building a Todo App - Step 14

Tell us what’s happening:

I am writing code according to given instructions but not getting there. what had hapened.
Retrieve the values from the titleInput , dateInput , and descriptionInput fields, and then save them in the properties title , date , and description of the taskObj object.

Your code so far

<!-- file: index.html -->

/* file: styles.css */

const taskForm = document.getElementById("task-form");
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", () =>

closeTaskFormBtn.addEventListener("click", () => {

cancelBtn.addEventListener("click", () => confirmCloseDialog.close());

discardBtn.addEventListener("click", () => {

taskForm.addEventListener("submit", (e) => {

  const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id);
  const taskObj = {
    id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`,
title :titleInput.value,
date : dateInput.value,
description : descriptionInput.value,
});// User Editable Region

title :titleInput.value,
date : dateInput.value,
description : descriptionInput.value,

// User Editable Region

Your browser information:

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

Challenge Information:

Learn localStorage by Building a Todo App - Step 14

Hello @ziaurrehman.official!

Your code submission below has some duplicated code. Additionally, there are some syntactical/style issues with the key/value pairs you have written - the colon should immediately follow the key, followed by a space, followed by the value.

It might behove you, to reset this step and reenter your amended code.

Does this help?

Good luck with the remainder of the challenge.