var cookieValue = document.getElementById("demo");
var value = cookieValue .getAttribute('value');
if(typeof(Storage)!=="undefined")
{
alert(value);
localStorage.setItem = ("GetData" , value);
alert(localStorage.setItem);
}
function loading()
{
alert("coming");
var allcookies = localStorage.getItem('GetData');
alert(allcookies);
}
Above is the way I am setting localStorage.setItem and I am getting LocalStorage.
But Where I didn’t get the output it is showing Null. Please Suggest me any Solution.
Your code should be :
OR