Question

I'm new to javascript and so I don't fully understand passing objects... my final product is simple build a comma separated counter that doesn't reset when someone refreshes the page. Guymid build a jsbin demo http://jsbin.com/IyavAPoN/1/edit. It seems that the solution to my problem is pretty straightforward but I can't seem to put them together.

to not reset, someone suggested using sessionStorage which seem to work on another code but I can't seem to incorporate it to the codes that I have as reflected in the JSBin Link.

Any help is much appreciated.

Was it helpful?

Solution

The way to do it is simply do localStorage: http://jsbin.com/ogeYOZa/2/ i basically just store values in localStorage and that's the only difference. However, there are a few more: Instead of just using +=1 to increment values, I use parseInt because localStorage values are strings.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top