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

Tabish Kazi
Tabish Kazi
5,938 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,938 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