A.Adams A.Adams - 4 years ago 71
Javascript Question

How do i store my registration details in local storage?

I made a registration webpage for my project but i want to store the details in local storage but it doesn't seem to save the phone number and address details. I've checked the developer tools in Google Chrome (only browser i prefer to use) and it shows only the username, password, and email address being saved into local storage... any suggestions??

Answer Source

It looks to me like you are accidentally using "Password" three times. It should also be affecting address.

localStorage.PassWord = passW;
var address = document.getElementById("Address1").value;
localStorage.PassWord = address;
var phoneN = document.getElementById("PhoneNumber").value;
localStorage.PassWord = phoneN;

Change it to:

localStorage.PassWord = passW;
var address = document.getElementById("Address1").value;
localStorage.Address = address;
var phoneN = document.getElementById("PhoneNumber").value;
localStorage.PhoneNumber = phoneN;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download