I want to have a radio button or a toggle that will stay in the listed array that shows either one or the other, but have it stay that way so when I come back to it, say a day later it's still marked with how I left it the last time I was there.
I want to have a radio button or a toggle that will stay in the listed array that shows either one or the other, but have it stay that way so when I come back to it, say a day later it's still marked with how I left it the last time I was there.
Hi Jeff,
You would need to store the date: https://developer.mozilla.org/en-US/d...
You can store it in localStorage.
If all the items are in string form how will that work, will I have to convert all my information into object to time them?
Jeff,
You get current date:prenow = new Date().getTime();/pre
Save it as Last visit date, for example:prelocalStorage.setItem("lastEnter", now);/pre
When next visit, read it and subtract the current date from it:prevar lastEnter = localStorage.getItem("lastEnter");
var difference = new Date.getDate() - lastEnter;/pre
Now the difference between two dates in milliseconds is stored in 'difference' variable. You can convert it into days, dividing by (1000 60 60 * 24).