I am trying to put element ID's into an array upon clicking the element, and store this array in local storage. Then call this array, and push more element ID's every time an element is clicked. It is turning out to be trickier for me, than I thought it would be.
I am using javascript/jquery.
My code:
var reportArray = []
var storedArray = JSON.parse(localStorage.getItem("reportarray"));
if(storedArray == '') {
reportArray.push("foo");
localStorage.setItem("reportarray", JSON.stringify(reportArray));
} else {
reportArray.push(storedArray);
localStorage.setItem("reportarray", JSON.stringify(storedArray));
}
I realize this code is probably way off (it doesn't even work correctly), but I am at least giving it a try. Help please?
i3and also the functionsGetCandSetCGetCandSetC?