# Button counter save

**URL:** <https://forum.kirupa.com/t/button-counter-save/638401>\
**Category:** web dev\
**Created:** [June 22, 2018, 3:30pm UTC](https://forum.kirupa.com/t/button-counter-save/638401 "2018-06-22T15:30:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cedrusvn](https://avatars.discourse-cdn.com/v4/letter/c/aca169/32.png) [@cedrusvn](https://forum.kirupa.com/u/cedrusvn)\
**Post date:** [June 22, 2018, 3:30pm UTC](https://forum.kirupa.com/t/button-counter-save/638401/1 "2018-06-22T15:30:04Z")

</div>

ello, so i have this button that counts every time you tap it, but whenever you refresh or closes the tab it resests.

I’ve been trying for so long to find a way for it to save your progress, but nothing seems to work. Can u help me?

```auto
<body>
<div style=" text-align: center;" 
<h1>Hello my friend if you love chocobos, then you are the right place</h1>
<br>
   <script type="text/javascript">
   var Love = 0;
   function onClick() {
       Love += 1;
       document.getElementById("Love").innerHTML = Love;
   };
   </script>
   <input type="image" src="heart.png" onclick="onClick ()" width="62" height="62" />
   <p>Love given: <a id="Love">0</a></p> 

</div> 

```

---

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [June 24, 2018, 5:24am UTC](https://forum.kirupa.com/t/button-counter-save/638401/2 "2018-06-24T05:24:41Z")

</div>

There are several ways you can persist this information. The more complicated approach would be to save this information on a remote server. The simpler approaches involve saving things local to your machine - cookies, session storage, and local storage. This tutorial explains how you can use local storage for something this: [https://www.kirupa.com/things\_to\_do\_with\_data/web\_storage.htm](https://www.kirupa.com/things_to_do_with_data/web_storage.htm)

🙂
