Page 2 of 2
Clickable list problem
Posted: Thu Apr 05, 2012 2:08 pm
by maxkatz
It will store all the items if you use a different key. If you use the same key it will be overwritten each time.
http://tiggzi.com/view/7bbf33e1-3238-...
Click on the first item.
This is my code:
code
alert ('About to save key1/value1 into Local Storage');
localStorage.setItem('key1', 'value1');
/code
Clickable list problem
Posted: Thu Apr 05, 2012 4:54 pm
by mcgrathken.kmg
Hi Max
I have tried this simply using
localStorage.setItem("key1", "value1");
localStorage["key1"] = "value1";
on the click event and it still wont work
Clickable list problem
Posted: Thu Apr 05, 2012 5:10 pm
by maxkatz
Did you check with Chrome Developer Tools that the value is not there?
Clickable list problem
Posted: Thu Apr 05, 2012 5:23 pm
by mcgrathken.kmg
yes i can get this but it wont add the clicked item to localstorage
Clickable list problem
Posted: Thu Apr 05, 2012 5:25 pm
by maxkatz
Which part exactly can you get?
Clickable list problem
Posted: Thu Apr 05, 2012 5:32 pm
by mcgrathken.kmg
i can get the same as in your screenshot above.
i'm trying to add each clicked item to a list to localstorage
Clickable list problem
Posted: Thu Apr 05, 2012 5:38 pm
by maxkatz
When you render the list you need to store the item label, then on click get the value and store it in Local Storage. Almost the same thing is done here: http://help.gotiggr.com/getting-start...
Clickable list problem
Posted: Thu Apr 05, 2012 5:44 pm
by mcgrathken.kmg
yes but surely i dont need a second label to just store the item in local storage.
It is not required on a different page.
Clickable list problem
Posted: Thu Apr 05, 2012 5:46 pm
by maxkatz
You don't, you can just read off the label shown.