so i have buttons,many of them i want to click on them and between each click there should be 0.1 sec delay how i can do it? buttons(multiple of them):
<div class="egg" id="egg1" onclick="egg.play(1);"></div>
<div class="egg" id="egg2" onclick="egg.play(2);"></div>
and so on until 27 buttons so how i can click on those 27 buttons?
here is what i use it works fine for 1 button any way how to make it for 27 button and delay of 0.1 sec between each click?also i want it in function, because i want to call the function...
function clickegg(){
$("#egg1").click();
setTimeout(clickegg, 1000);
}
no problem if it's jquery or javascript.thanks
Template string + recursion with terminating condition:
function clickegg(which=1){
$(`#egg${which}`).click();
if(which < 27) {
setTimeout(() => clickegg(which+1), 100);
}
}
clicks #egg1, then #egg2 after 0.1s, then #egg3, and so on until hitting the final number.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With