I want to create 3 checkboxes that when checked will periodically click on a button (each).
The left and middle button are the same case, only with different aesthetics. Like this:
<a id="fightButtonBerserk1" name="defender" value="Berserk" class="button foundation-style smallhelp profileButton fightButton" title="" href="#">
<i class="icon-friends"></i>Berserk! (5 golpes)</a>
The right button is this:
<a id="fightButtonBerserk2" name="attacker" value="Berserk" class="button foundation-style smallhelp profileButton fightButton" title="" href="#">
<i class="icon-friends"></i>Berserk! (5 golpes)</a>
This is the code to insert the checkboxes in the location I want, that I have so far:
function addDomElements(){var a=$('<div class="foundation-radius fightContainer foundation-base-font"></div>'),
b=$('<input type="checkbox" class="smallerBox" id="EsquerdaHitBox" name="EsquerdaHitBox" style="margin:1px !important;line-height:10px !important;">'),
c=$('<label class="checkboxlabel" for="EsquerdaHitBox" style="margin-right: 20px;">Hit Left</label>'),
d=$('<input type="checkbox" class="smallerBox" id="MeioHitBox" name="MeioHitBox" style="margin:1px !important;line-height:10px !important;">'),
e=$('<label class="checkboxlabel" for="MeioHitBox" style="margin-right: 20px;">Hit Middle</label>'),
f=$('<input type="checkbox" class="smallerBox" id="DireitaHitkBox" name="DireitaHitkBox" style="margin:1px !important;line-height:10px !important;">'),
g=$('<label class="checkboxlabel" for="DireitaHitkBox" style="margin-right: 20px;">Hit Right</label>');
a.append(b),a.append(c),a.append(d),a.append(e),a.append(f),a.append(g),
$(a).insertAfter($('[class="foundation-radius fightContainer foundation-base-font"]')[1])}
I already have something that is half functional but I need to turn it off and on all the time when I want to stop.
I wanted to activate this kind of code with each checkbox:
var button=document.getElementById("fightButtonBerserk1");
setInterval(function(){
button.click();
}, 30000);
var i = setInterval(function() {
window.location.reload();
}, 300000);
Can someone help me?