Hello,
if you ment to change this (first code)
apPoints = capPoints + 1;
localStorage.setItem("lsPoints", capPoints);
by that (second code)
capPoints = parseInt(localStorage.getItem("lsPoints"));
capPoints = capPoints + 1;
localStorage.setItem("lsPoints", capPoints);
it doesn´t work, I think because what you write to me, can´t "get" something what is not "set", becuase it looked like it before. the value of lsPoints is NaN.
It worked but only if I let the first version (but it remebered the points, but after first success changed it to zero and started again to count), but lsPoints were set, so if I changed the code (the second), everything was perfect until I delete the lsPoint and wanted to start completly new.
But of course it is not godd functiion. When I tried to set lsPoints first and than use the second code it was the same after first succes start again from zero.
Yes sorry about that. I thought I might have made a mistake with that code and realized it on the subway as I was heading home. What you need to have in there is something that evaluates if lsPoints is null (i.e. has not yet been set). This way if someone hasn't been on the site yet, lsPoints will be set to 0, but if they are coming back it will remember the score.
Try this code for the first time you reference the local storage.
if(localStorage.getItem("lsPoints") == null){
localStorage.setItem("lsPoints", 0);
}else{
capPoints = parseInt(localStorage.getItem("lsPoints"));
}