Data From Local Storage To Be Displayed In Text Box On Separate Page

The problem is, is that I can set data into local storage, but I can’t retrieve it for it to be displayed on another page text box.

my javascript code is below

function populateStorage() {
localStorage.setItem(“name”,document.getElementById(“name”).value);
localStorage.setItem(“description”,document.getElementById(“description”).value); this set the data into local storage
}

function retrieveStorage() {
var currentName = localStorage.getItem(“name”);
var currentDescription = localStorage.getItem(“description”);

document.getElementById("name").value = currentName;
document.getElementById("description").value = currentDescription;

}

I am lost for an answer is the retrieve function code all wrong?
On the page where the data is to be retrieved and displayed does the “ID” to the text box within the HTML make a difference seeing as its named the same as the original page’s text box?
Can anyone help please my deadline for hand in is tomorrow.

Try putting localStorage.getItem(“name”) directly into the console on each page to make sure the local storage is being set properly.

thanks for your reply but can you explain what you mean by “console” do you mean to print out as in “console.log” ??

Right click the page -> Inspect (chrome, not sure how it works on other browsers). This opens the DevTools, select the console tab. You can type JavaScript code here just like you can in your JS files.

Hi Gouldie sorry its late here i am being “dim” …lol I have done this especially on the page where I want to receive or “GET” the data and its working but not displaying in the textbook where i want it to be displayed

Try using .textContent or .innerText instead of .value for the text boxes

Hi Gouldie I have tried both as suggested and still no text in the boxes…Ahhhh …lol

Ive just gone with what you have suggested and hard coded a string in,and it works with some hard code, but still the box does not receive the "GOT data from initial landing page box

Ive run the function

function retrieveStorage() {
var currentName = localStorage.getItem(“name”);
var currentDescription = localStorage.getItem(“description”);

document.getElementById("name").value = currentName;
document.getElementById("description").value = currentDescription;

}

in the javascript console for the page where the data that has been set and saved and its coming back as “undefined” could you help me any further please?

what I mean is the page where the data is being “set” is saving, its the page where the data is to be retrieved and displayed that I ran the function in the page’s console and its coming back “undefined”