+ 8
How to save data in local storage with javascript
local storage
5 Réponses
+ 2
Just googled this out, can try...
function setPerson(){
var person = { 'name': getElementById('name'), 'photo': getElementById('photo')};
// Put the object into the storage
alert(person);
localStorage.setItem('person', JSON.stringify(person));
};
+ 2
Here is a copy of a reply to a similar question recently. Hope it helps:
Not sure if this will help but if you would like to look at an example you could check out my Recipe Box which uses local storage. See https://code.sololearn.com/W930yAQ9H12Q/#html.
0
localStorage.setItem("name",item);
to get stored item
localStorage.getItem("name");
0
It's best use id:
localStorage.setItem('id', '{key: value, key2: value, ...}');
in SoloLearn don't work localSrorage.