I’m developing a web application in iPhone using Phonegap. In this app, I want to send data from one page to another within the same index.html file. I’m using local storage to send data, but I am unable to send values. whenever the local storage statements are encountered, it skips the remaining statements also in that javascript function. Please tell me the solution. Do I need to add any plugin to use local storage?
{
var name = document.getElementById("usernameTextField").value; //TextField of page1
var fullname = document.getElementById("nameLabel").innerHTML; //label of page1
localstorage.setItem("userName", name);
localstorage.setItem("fullname1", fullname);
var getusername = localstorage.getItem("userName");
var getname = localstorage.getItem("fullname1");
fullnameLabel.innerHTML = getname.value; //label of page2
userNameLabel.innerHTML = getusername.value; //label of page2
}
Try with this
Please check the full code here