Html code index.html this is my html code here i just put the button and a text input.i want to get the text input value there on the page even we refresh it(means that old vaue remains there on the page)
<div id="result">div</div>
<input type="text" id="tt" />
<button id="btn" onClick="calls()">submit</button>
here is the script code ,i am using this code for the local storage but it doesnot work after the page refreshing.
function calls()
{
if(typeof(Storage)!=="undefined")
{
localStorage.lastname=document.getElementById("tt").value; ;
document.getElementById("result").innerHTML="Last name: " + localStorage.lastname;
}
else
{
document.getElementById("result").innerHTML="Sorry, your browser does not support web storage...";
}}