Site icon Hip-Hop Website Design and Development

Save in localstorage and db and present it later

I’m not one of many individuals who desires to get one thing with out doing something, however this time I would like your assist urgently.

I take advantage of Elementor Professional. I’ve a button that’s restricted to 7 clicks, when clicking quantity 7 is disabled, and that is saveed in localstorage to show later. My drawback if the consumer login from diferent machine, the rely begin againg in 0. and clearly the code do not work for my want, The consumer after 7 click on By no means can click on once more.

How can resolve this, please any concept?

that is the code… Thank You Advances and Cheers to All.

window.addEventListener("load", ()=>{
 // Learn the saved state from native storage (if not but saved, will probably be null)
 let clickcount3 = localStorage.getItem("localStorage.clickcount3");

 if(localStorage.clickcount3>6)
     doc.getElementById("showResultMasPack").model.visibility = "visible";

});
 
operate CounterMastPack() {
if (typeof(Storage) !== "undefined") {
 if (localStorage.clickcount3) {
   localStorage.clickcount3 = Quantity(localStorage.clickcount3)+1;
 } else {
   localStorage.clickcount3 = 1;
 }
 doc.getElementById("resultMastPack").innerHTML = localStorage.clickcount3 + " Click(s).";
} else {
 doc.getElementById("resultMastPack").innerHTML = "Sorry, your browser does not support web storage...";
}
if(localStorage.clickcount3>6)
doc.getElementById("showResultMasPack").model.visibility = "visible";      
}```