localstorage in php code example
Example 1: local storage javascript
function createItem() {
localStorage.setItem('nameOfItem', 'value');
}
createItem()
function getValue() {
return localStorage.getItem('nameOfItem');
}
console.log(getValue());
Example 2: javascript save data to local storage
localStorage.lastname = "Smith";
document.getElementById("result").innerHTML = localStorage.lastname;
localStorage.removeItem("lastname");
Example 3: localstorage
var cat = localStorage.getItem('myCat');
Example 4: localstorage
localStorage.removeItem('myCat');