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

JavaScript

Pauline Orr
Pauline Orr
15,321 Points

Cookies in JavaScript- Help for Finals?

I'm currently in a JavaScript summer class and for finals we must use cookies. My teacher barely went over it and its due next week. Information on the internet has been confusing too.

Basically I have a form that has an input for name, value (place value reads "write an adjective"), and expire. A subheading at the top currently reads "A Journey". I'd like to press a button that will take the value and insert it to read "A (adjective) Journey" and also take you to the top to see the change.

It'd also be a cool bonus in the future if you reload or revisit the page it will read "Welcome back name!"

And I feel clueless about setting the expiration date too. Any help will be greatly appreciated. I know my professor will not be helpful if I were to email him my questions. The current coding I have now is such a mess that I'm not bothering posting it.

2 Answers

Around half way down the page, you should find the answers you seek :) http://www.w3schools.com/js/js_cookies.asp

Pauline Orr
Pauline Orr
15,321 Points

That is sort of helpful but I'm still not sure how to just get a cookie's value.