To-do list
Hi there! I'm trying to create a todolist using js.
• I have added the data to local storage
• Get the data from local storage and show it on the ui
• Now in trying to create a function to delete the data from the ui and from the local storage but it deletes the whole data from local storage
• I'd appreciate if you help me to resolve this issue and other tips
Github repo:
https://github.com/Myragull/Todolist
Live at:
https://myragull.github.io/Todolist/
GitHub
GitHub - Myragull/Todolist: A simple todolist project built with ht...
A simple todolist project built with html ,css and javascript - Myragull/Todolist
14 Replies
you need to get the data from localstorage turn it back into array then remove selected item from that array and turn the array back to a string a save it in localstorage. You are now removing all entries
I have updated the changes can you check them?
looks good and it is working so job done 🙂
And also is there any other thing that needs to be fixed
Like i try to insert the code anywhere to make it works
would you like to work on a bug? @Myra
Enter 2 tasks with the same name.
Example:
learn html
learn html
And try to delete and refresh the browser. Both of your entries would be deleted.
Folks might say that it is unnecessary that you would have 2 same tasks on a single todo list, which is fine.
I am trying to make you understand that, this is good, but always try to assign some id while you are inserting the tasks.
Sure
So whenever you press delete, you extract the id instead of the value that the user is trying to delete, and delete that particular record which has the id in the array.
Ok
Makes sense?
Yes, I'm trying to do
I have just given you the starting point, there are some other things which you need to consider.
I have tried to implement the things that you told me in my code would you please check them? @Chief
perfect! works fine.
hope you learnt something.
good work
Yes, thaks for the help! @Chief