From ce8ea6f6ce2abaa39ed1dc89b1855a1e56d4c846 Mon Sep 17 00:00:00 2001 From: Preeti Tyagi <68293926+preeti-t@users.noreply.github.com> Date: Thu, 11 Dec 2025 12:41:59 +0100 Subject: [PATCH 1/2] Update index.html changes made --- Sprint-3/todo-list/index.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sprint-3/todo-list/index.html b/Sprint-3/todo-list/index.html index 4d12c4654..6f7642a6e 100644 --- a/Sprint-3/todo-list/index.html +++ b/Sprint-3/todo-list/index.html @@ -34,7 +34,9 @@

My ToDo List

- +
+ +
From 7b91bedda47f2ea6200088b14fc64fda1992454f Mon Sep 17 00:00:00 2001 From: Preeti Tyagi <68293926+preeti-t@users.noreply.github.com> Date: Thu, 11 Dec 2025 12:49:20 +0100 Subject: [PATCH 2/2] Update script.mjs added event listener to delete task completed --- Sprint-3/todo-list/script.mjs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Sprint-3/todo-list/script.mjs b/Sprint-3/todo-list/script.mjs index ba0b2ceae..74d3e0274 100644 --- a/Sprint-3/todo-list/script.mjs +++ b/Sprint-3/todo-list/script.mjs @@ -1,3 +1,4 @@ + // Store everything imported from './todos.mjs' module as properties of an object named Todos import * as Todos from "./todos.mjs"; @@ -45,7 +46,16 @@ function render() { }); } - + // Delete completed tasks button + document.getElementById("delete-completed-btn").addEventListener("click", () => { + // Keep only tasks that are NOT completed + for (let i = todos.length - 1; i >= 0; i--) { + if (todos[i].completed) { + Todos.deleteTask(todos, i); // call your module function + } + } + render(); + }); // Note: // - First child of #todo-item-template is a
  • element. // We will create each ToDo list item as a clone of this node. @@ -73,4 +83,4 @@ function createListItem(todo, index) { }); return li; -} \ No newline at end of file +}