Dr.Ajay Kashyap

Dr.Ajay Kashyap

  • NA
  • 521
  • 285.1k

How to add multiple Textbox value to local Storage HTML

Jul 21 2017 4:31 AM
How to add multiple Textbox value to local Storage HTML. 
 
 
This Is My Html Page :-
 
<!doctype html>
<html>
<head>
<title>Local Data Storage</title>
<script>
function save(){
debugger;
var fieldValue = document.getElementById('textfield').value;
localStorage.setItem('text' , fieldValue );
}
function load(){
debugger;
var storedValue = localStorage.getItem('text');
if(storedValue)
{
document.getElementById('textfield').value = storedValue
}
}
</script>
</head>
<body onload="load()">
<lable>Name:- </lable>
<input type="text" id="textfield" />
<lable>Last Name:- </lable>
<input type="text" id="textfield1" />
<input type="button" value="save" onclick="save()"/>
</body>
</html>
 

Answers (2)