I would like to save the data of the first check boxes to session Storage and I would like to retrieve the data and set them to the second page on load from the session storage.
1st HTML
<body>
<label for="1">
<input type="checkbox" name="num" id="1" checked="checked" value="1" >1
</label>
<label for="2">
<input type="checkbox" name="num" id="2" value="2" >2
</label>
<label for="3">
<input type="checkbox" name="num" id="3" value="3" >3
</label>
<label for="4">
<input type="checkbox" name="num" id="4" value="4" >4
</label>
<button onclick="saveSession()">save</button>
<script type="text/javascript">
function saveSession() {
// I want to save the value of the radio button to sessionStorage here
}
</script>
</body>
In my second HTML I would like to retrieve this data and set the value of the radio buttons to the same.
2nd HTML
<body onload="type()">
<label for="1">
<input type="checkbox" name="num" id="1" checked="checked" value="1" >1
</label>
<label for="2">
<input type="checkbox" name="num" id="2" value="2" >2
</label>
<label for="3">
<input type="checkbox" name="num" id="3" value="3" >3
</label>
<label for="4">
<input type="checkbox" name="num" id="4" value="4" >4
</label>
<script type="text/javascript">
function type() {
//I want to get the data with sessionStorage.getItem()
}
</script>
</body>
Thanks in advance.