From 71b4e72f5179d5474797ed5f125f17d01551dae7 Mon Sep 17 00:00:00 2001 From: Mihir-Maurya <76941122+Mihir-Maurya@users.noreply.github.com> Date: Tue, 28 Feb 2023 12:15:14 +0530 Subject: [PATCH] update submit function it was creating empty list when we don't give any input. i updated the code so that before creating a list it will check whether it contains a value or not. --- projects/to-do-list/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/to-do-list/index.js b/projects/to-do-list/index.js index 222b598..7aac765 100644 --- a/projects/to-do-list/index.js +++ b/projects/to-do-list/index.js @@ -13,7 +13,9 @@ if (list) { formEl.addEventListener("submit", (event) => { event.preventDefault(); - toDoList(); + if(inputEl.value){ + toDoList(); + } }); function toDoList(task) {