Use mouseup
Wecan change the above code to continuously count when a user clicks and holds the button: https://raw.githubusercontent.com/finsweet/jqueryCourse/main/jquery%20events/ex21.js?actionable=true
The setInteval() function uses an anonymous function and a number, N, specified in milliseconds.
The setInterval() function will execute anything inside the anonymous function, after every N milliseconds.
In our example above the count value is increased and updated to the webpage after every 500 milliseconds.
The interval variable is used to store our setinterval() function so that we can stop it with clearInterval(interval) when the mouse is released from hold position.
$(document).ready(function(){
XT1
});
</script>
Live demo
<div id="minidivpage" class="example-live"><div class="w-row"><div class="w-clearfix w-col w-col-1"><h1 id="counter-value" class="heading-6">0</h1></div><div class="w-col w-col-2"><a id="counter" href="#" class="button-2 w-button">Hide</a></div><div class="column-2 w-col w-col-9"><div id="hidden-text" class="box">Password Hidden text</div></div></div></div>
$(document).ready(function() {
XT1
});
</script>