problem with array in localstorage
Hi Michael,
No, you can use the following code to save to variable:
prevar curent_order = $(this).find("option:selected").text();
localStorage.setItem("curent_item", curent_order);/pre
Catch up wih the Appery.io community on our forum. Here you'll find information on the lastest questions and issues Appery.io developers are discussing.
https://forum.appery.io/
Hi Michael,
No, you can use the following code to save to variable:
prevar curent_order = $(this).find("option:selected").text();
localStorage.setItem("curent_item", curent_order);/pre
Hi,
trying to save the value of selectmenu to local storage. Katya suggested this code, but it doesn't work
var curent_order = $(this).find("option:selected").text();
localStorage.setItem("curent_item", curent_order);
Hello! It works as we can see, but you have a typo in JS on chickenpizzaselectmenu-Value change. You have:
pre$(this).closest("[name=chickenpizzamobilegrid]").find("[dsid=chickenpizzaPricelabel]").text(localStorage.getItem("current_order"));/pre but should be pre$(this).closest("[name=chickenpizzamobilegrid]").find("[dsid=chickenpizzaPricelabel]").text(localStorage.getItem("curent_order"));/pre
you set curent_order variable but retrieve current_order (double rr)
Thanks Marina,
but the code below doesn't save the selectmenu value in localstorage
var curent_order = $(this).find("option:selected").text();
localStorage.setItem("curent_item", curent_order);
Try
prevar curent_order = $(this).find("option:selected").val();
localStorage.setItem("curent_item", curent_order);/pre
Hi Michael,
Please delete all your JavaScript codes on chickenpizzaselectmenu-Value change
and create an only JS code instead:
prevar curent_item = $(this).find("option:selected").text();
localStorage.setItem("curent_item", curent_item);
$(this).closest("[name=chickenpizzamobilegrid]").find("[dsid=orderlabel]").text(localStorage.getItem("curent_item"));
var curent_order = $(this).find("option:selected").val();
localStorage.setItem("curent_order", curent_order);
$(this).closest("[name=chickenpizzamobilegrid]").find("[dsid=chickenpizzaPricelabel]").text(localStorage.getItem("curent_order"));/pre
Thanks Katya, all working now,
I didn't think it would make a difference using 1 event or 4 as long as they were in the correct order.
thanks alot
Michael,
This wouldn't make a difference, there were some typos in your code.
It's all together, you can see where the names are used and where are not.