Hey, I am trying to make a website that has four buttons and tracks how many times each button has been pressed. The problem is that the values are only saved per session, so when you refresh the page all the values are reset to 0. You can only see the button presses in your session and not from other sessions and from other people's sessions.. How do I store the values somewhere so that the total values can always be displayed? Here is my code if that helps: let potatoTotal = 0;let tomatoTotal = 0;let carrotTotal = 0;let cucumberTotal = 0;$w.onReady(function () {$w('#button2').onClick(() => {potatoTotal = potatoTotal + 1;$w('#text9').text = 'Potato: ' + potatoTotal;});$w('#button1').onClick(() => {tomatoTotal = tomatoTotal + 1;$w('#text8').text = 'Tomato: ' + tomatoTotal;});$w('#button3').onClick(() => {carrotTotal = carrotTotal + 1;$w('#text10').text = 'Carrot: ' + carrotTotal;});$w('#button4').onClick(() => {cucumberTotal = cucumberTotal + 1;$w('#text11').text = 'Cucumber: ' + cucumberTotal;});});
top of page
Important forum update
This forum is migrating to one unified Wix community forum starting July 26th, and will be read-only during the process.
Wishlist Page is the official platform for requesting new features. You can vote, comment, and track the status of the requested features.
bottom of page