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

149
Views
Save in localstorage and db and show it later

I use Elementor Pro. I have a button that is limited to 7 clicks, when clicking number 7 is disabled, and this is saved in localstorage to display later. My problem if the user login from different device, the count start againg in 0. and obviously the code don't work for my need, The user after 7 click Never can click again.

How can resolve this?

this is the code:

<script>
 // On page load (or in whatever event creates the button)
window.addEventListener("load", ()=>{
 // Read the saved state from local storage (if not yet saved, will be null)
 let clickcount3 = localStorage.getItem("localStorage.clickcount3");

 if(localStorage.clickcount3>6)
     document.getElementById("showResultMasPack").style.visibility = "visible";

});
 
function CounterMastPack() {
if (typeof(Storage) !== "undefined") {
 if (localStorage.clickcount3) {
   localStorage.clickcount3 = Number(localStorage.clickcount3)+1;
 } else {
   localStorage.clickcount3 = 1;
 }
 document.getElementById("resultMastPack").innerHTML = localStorage.clickcount3 + " Click(s).";
} else {
 document.getElementById("resultMastPack").innerHTML = "Sorry, your browser does not support web storage...";
}
if(localStorage.clickcount3>6)
document.getElementById("showResultMasPack").style.visibility = "visible";      
}
</script> 
about 4 years ago · Juan Pablo Isaza
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!