Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
SAMUEL LAWRENCE
Courses Plus Student 8,447 PointsChildren traversing
Hi guys in the course, traversing the DOM, we created an app that can add list items to a page and remove and move them up and down, however, every time we refresh the page any items added to the list disappears. How can we make it so that on reload the new items added will be a part of the original list? I thought I could create a new variable and store the old list in it then have it load every time we refresh, but not sure how to do that or if it will work. Any thoughts.
2 Answers
Steven Parker
243,656 Points I got alerted by your tag.
You can hold data between page loads using local storage. There's a course on it here: Using Local Storage with JavaScript.
Scott Junner
9,010 PointsAt a guess an easy way out would be to write to a JSON file as the changes are made to the list and then read that JSON file on reload.
SAMUEL LAWRENCE
Courses Plus Student 8,447 PointsHi Scott Junner thanks for the reply, but I don't know much about JSON so will need to research. Thanks for the suggestion.