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!
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!
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.
I don’t really know how to do that. How would I?
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.
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.
nvm I fixed the addButton disappearing
It works now. I had to change the event to “form-submit”
Actually, for some reason it still reloads, but it does add the item to the list.
When do you think 2.2 will release?
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.
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