diff --git a/todo/index.html b/todo/index.html
index 4fc2b9e5..fecd693c 100644
--- a/todo/index.html
+++ b/todo/index.html
@@ -24,7 +24,7 @@
const main = document.querySelector("main");
const template = document.querySelector("template");
- const addItem = ({ done = false, text = "" } = {}) => {
+ const addItem = ({ done = false, text = "" } = {}, save = true) => {
const fragment = template.content.cloneNode(true);
const item = fragment.querySelector("p");
const button = item.querySelector("button");
@@ -34,12 +34,14 @@
const input = item.querySelector("input[type=text]");
input.value = text;
main.append(item);
+
+ if (save) saveItems()
};
const loadItems = () => {
const items = JSON.parse(localStorage.getItem("items")) ?? [];
for (const item of items) {
- addItem(item);
+ addItem(item, false);
}
};