File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ ul.id = "todoList"
2222
2323
2424todoHandler . 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 ) ;
You can’t perform that action at this time.
0 commit comments