Skip to content

Commit 0687ce1

Browse files
committed
📝🤔Todo
1 parent 976e51c commit 0687ce1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

‎Todo/public/app.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ ul.id = "todoList"
2222

2323

2424
todoHandler.addEventListener('click', async () => {
25-
let inputVal = todoInput.value
25+
let inputVal = todoInput.value.trim()
2626
if (!inputVal) {
2727
alert("field is empty")
2828
return;
@@ -58,7 +58,7 @@ function append(todo, id) {
5858
todoInput.value = ""
5959
ul.innerHTML += `
6060
<li class="todo-item">
61-
<input id="${id}" class="inp" value=${todo} type="text" readonly>
61+
<input id="${id}" class="inp" value="${todo}" type="text" readonly>
6262
<button class="btn-edit">Edit</button>
6363
<button class="btn-delete">Delete</button>
6464
</li>
@@ -80,12 +80,12 @@ ul.addEventListener('click', async (e) => {
8080
input.nextElementSibling.innerText = "Edit"
8181
}
8282

83-
let newVal = input.value
83+
let newVal = input.value.trim()
8484
let id = input.id
85-
if (newVal) {
85+
if (newVal.trim()) {
8686
try {
8787
await updateDoc(doc(db, "Todo", id), {
88-
todo: newVal
88+
todo: newVal.trim()
8989
})
9090
} catch (error) {
9191
console.log("The Error is in UpdateDoc", error);

0 commit comments

Comments
 (0)