suppose I have the following:
<div id="main">
<div id="wrapper">
<input/>
<input/>
<input/>
</div>
</div>
I want to use localstorage to store the whole wrapper. I am doing this:
function save(){
var nodeWrapper = $("#wrapper").html();
localStorage.setItem("wrapper", nodeWrapper);
}
function restore(){
var nodeWrapper = localStorage.getItem("wrapper");
$("#wrapper").html(nodeWrapper);
}
Q1: I found the value in the input does not get stored. I only get that three inputs. I know I can store these input one by one, but how can I store them all at once? For example: I have more fields under wrapper, is there any way to store them easily other than one by one?
Q2: I also found it's not working if I store the node itself instead of it's innerHTML. Can localstorage sotre a node?