Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript DOM Scripting By Example Improving the Application Code Next Steps

karan Badhwar
seal-mask
.a{fill-rule:evenodd;}techdegree
karan Badhwar
Web Development Techdegree Student 13,000 Points

not able to understand how to add local storage to the code

I am stuck on the Local storage and Drop down menu from few days I have watched the video and tutorial got it a bit but not sure how to implement it, Would somebody be able to help me with it.

The screenshot attached below https://w.trhou.se/t8jkhbpy37

Jason Larson
Jason Larson
7,961 Points

what exactly do you want to add to the local storage? Also, what do you mean about the drop down?

karan Badhwar
seal-mask
.a{fill-rule:evenodd;}techdegree
karan Badhwar
Web Development Techdegree Student 13,000 Points

Actually sir, Guil asked if we can try to do some manipulation like adding the data to local storage for data storage all the names of the guest i.e Guest List

and if we can add a drop down menu instead of the checkbox, that's what I am struggling with

1 Answer

Jason Larson
Jason Larson
7,961 Points

I don't have time to research the dropdown thing at the moment, and the localStorage thing is more of a challenge than it looks like at first because you would want to store an HTML Node Element rather than just some text, but below is code that will get you started and this link to how to json stringify a dom element on stackoverflow should give you the rest of what you need.

I basically just adapted the code from the Using Local Storage workshop and am creating the list based on the names that were invited, so any edits to the guests will not be included when you reload the page. Also note that I did not provide a way to clear the local storage, so to do that, either remove all the guests individually or go to the console and enter localStorage.clear().

Here is the snapshot