[Solved] Saving the status of checkboxes using cookies?

[Solved] Saving the status of checkboxes using cookies?
0

#1

Hi all!

I’d like to save the statues of checkboxes on a site to the users computer. Here is what I have:

<input type="checkbox" name="c1"> Brakes - On<br>
<input type="checkbox" name="c1"> Throttle - Idle<br>

Say if the user ticks <input type="checkbox" name="c1"> Brakes - On<br>, is there a way to save that to their computer and then when they reload the page to keep it?

Thanks!


#2

You can look into it more here

Essentaily, you can create a JSON object and save it to localStorage, then on page-load load the JSON string saved in localStroage and parse it into usable JSON.


#3

Yep, I want to use local storage on the users device. :smile:


#4

For an example, you can see how I used it in http://codepen.io/AbdiViklas/pen/PbZqPK (including a check for whether it’s present and error handling if not)


#5

Thank you very much!


#6

Managed to get a simple solution!