Hello.
I created an array.
How can I get the value of the array on index?.
Array is stored in a localstorage.
Hello,
At first you should convert a string to an array (values in localStorage are stored as a string):
var arr = jQuery.parseJSON(localStorage.getItem("arrayName"));
After this you'll get a simple array, its elements are available by index, for example:
alert(arr[0]);
Where do I insert this code?
Hello!
You should add this code where you need to get value on index.
Hello.
This code does not work.
Help me, please.
Could you clarify where did you add this code? Screenshots would help.
var arr = jQuery.parseJSON(localStorage.getItem("id"));
alert(arr[0]);
This code does not work.
Help me, please.
Please post screenshot where do you use this code?