Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

150
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda