Todo list /w local storage

https://replit.com/@Bedrockminer/Todo-list-w-local-storage?v=1

I made a todo list creator, that has local storage, auto saving and more!

8 Likes

3 posts were split to a new topic: Will Robtop update GD soon?

It looks really good! Just some small feedback, edit your code so that it submits the form on form submit, and add e.preventDefault() to prevent the page from reloading.

2 Likes

I don’t really know how to do that. How would I?

2 Likes

Making an event listener is pretty simple, just wait for an event, give it a name, and run the follow-up. Here’s an example of an event listener waiting for a button submission,

button.addEventListener("submit", e => {
    e.preventDefault()
    // Save to LocalStorage and add to page or something
});

This will prevent the page from reloading when using a submit event listener. Based on your code, you might have to do some refactoring and stuff to get this to work.

3 Likes

That didnt work for some reason, but I think it’s because the addButton isn’t in the form that contains my input. For some reason whenever I put the addButton into the form, it just disappears.

1 Like

nvm I fixed the addButton disappearing

1 Like

It works now. I had to change the event to “form-submit”

2 Likes

Actually, for some reason it still reloads, but it does add the item to the list.

1 Like

When do you think 2.2 will release?

1 Like

Most likely late this year or early next year, or maybe even sooner. It was removed from Google Play due to its lack of updates, and the fact it doesn’t include Android’s more secure API. IIRC, it may also soon be removed from iOS.

2 Likes

The reason it would still reload is that you don’t have eventName.preventDefault() in your listeners. I would look online for some more information if you are confused.

Ok I fixed it now. I had to add that to my addToDoItem function for some reason instead of the formSubmit event listener

They added my CSS Gradient Generator extension but not this todo list, which I put into an extension. BTW I only updated my todo list extension and not the repl I linked here