Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Dynamic divs disappear on refresh?

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #262867
    jupiterisland
    Participant

    sorry if code is a bit cumbersome I’m a very new “developer”

    So, I created a form and when you hit submit 3 things happen:
    1. Input values are stored in an array inside localStorage.
    2. Values are retrieved and are shown up in dynamically created divs.
    3. Prevent submit (form is not sent).

    https://codepen.io/jupiterisland/pen/Rjygmv

    My problem is whenever I refresh the page after submitting new entries, the dynamically created divs disappear (while they’re still stored in localStorage).
    How do I keep my submitted divs even after refresh?

    I’ll appreciate any help/suggestion!
    Thanks.

    #262878
    JeroenR
    Participant

    You should do the same function when loading the page as on the submit.
    I have an example here: https://codepen.io/jeroenreijs/pen/VrxGXO
    The loading of the tasks is done in here on submit and on loading the page.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.