How to get/set the LocalStorage value?
■ Summary
If you want to save/load the small data, the Local Storage is the good way.
■ Reference Site
http://www.w3schools.com/html/html5_webstorage.asp
If you want to save/load the small data, the Local Storage is the good way.
■ Reference Site
http://www.w3schools.com/html/html5_webstorage.asp
/*******************************
* HTML File
*******************************/
<input type="checkbox" id="checkbox1">checkbox</input>
/*******************************
* Javascript File
*******************************/
// Set the LocalStorage value
var checkbox = document.getElementById("checkbox1");
localStorage.setItem("checkbox1", checkbox.checked);
// Get the LocalStorage value
var checked = JSON.parse(localStorage.getItem("checkbox1"));
document.getElementById("checkbox1").checked = checked;