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 JavaScript and the DOM (Retiring) Responding to User Interaction Listening for Events with addEventListener()

Tabish Kazi
Tabish Kazi
5,951 Points

Using properties from two different pages in a single JavaScript file.

I want to use input value from an input element of one page and use that value as a textContent for a paragraph on another page.

For example, I have an input field (input-1) on one page and a button (button-1) on the same page. Now, I want to add a click event to button-1 so that input-1.value is stored as a textContent for a paragraph (say, pargraph-1) which is on a different webpage.

Thank you.

2 Answers

Tabish Kazi
Tabish Kazi
5,951 Points

Thank you for the reply Shaun, but I didn't understand any of the answers there.

Tabish, I am really curious about how you handle this. All I can think if (from a new learner's stand point) is maybe your looking for info on local storage?

https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage