Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

100
Views
Website -> Count Button Clicks and never reset

Holaaa

I wanted to create a simple website containing a button. If I press the button 5 times, it says 5. When I refresh the page, it should still say 5. And when You load the page, it also says 5 and you can go on clicking.

I know how to build a counter for ONE session and one user, but I have nooo idea how to implement it to be stored "online".

I know that I need to implement a database to store the value and load the latest click-value once the website is opened but I dont know where to simply start

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

You can use localstorage to persist the count.

Example when the page starts:

var cat = localStorage.getItem('miGato');

Example to save the count:

localStorage.setItem('miGato', 'Juan');

The documentation is:

Localstorage

about 4 years ago · Juan Pablo Isaza Report

0

Yes you can use Window.localStorage, Syntaxis

var cat = localStorage.setItem('miGato', 'Juan');
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!