local storage
function setItem(name, value) { localStorage.setItem(name, value); } function getItem(name) { localStorage.getItem(name); } function deletItem(name) { localStorage.removeItem(name); } function clearStorage() { localStorage.clear(); }
local storage
function setItem(name, value) { localStorage.setItem(name, value); } function getItem(name) { localStorage.getItem(name); } function deletItem(name) { localStorage.removeItem(name); } function clearStorage() { localStorage.clear(); }
local storage
As the answers here already talk about the coding aspect. I will talk about the concept. Local storage is basically an object stored in the specific browser you are using in that moment. And thus it is tied to that browser in that device. It's duration is infinite so it never expires If you only want to store data that only lasts for that browser session( starts when you open a window and ends when you close it) then the best choice is sessionStorage
local storage
localStorage.setItem('localStorage', 1);
local storage
<form action="2.html" onsubmit="callme()"> <p>Enter your name</p> <input id="tbName" type="text"> <button type="submit" value="submit">Submit</button> </form> <script> function callme(){ var name = document.getElementById('tbName').value; sessionStorage.setItem('userName', name); } </script>
local storage
var answer = localStorage.key(1); // this statement will retrieve the value of the second item in localStorage.
local storage
window.localStorage.setItem("grade","One"); //in this case, the `grade` is the key while `One` is the value.
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us