S
S
Sergey Goryachev2017-12-02 13:12:21
JavaScript
Sergey Goryachev, 2017-12-02 13:12:21

There are several checkboxes on the page, how to click on them with an interval through JS?

There is a code on the page.

<input class="checkbox" onclick="checkAttack(this);" id="A2" name="A2" value="2" type="checkbox">
<label class=" " for="A2">А2</label>

How to make a GreaseMonkey browser script through JS with a certain interval?
It is necessary that it works in the "background", the tab is open, but I look at another tab, and the "clicks" work.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg, 2017-12-02
@politon

To console https://jsfiddle.net/2v20tm0j/1/

x = document.querySelectorAll("checkbox");
setInterval(function(){
if(x.checked == true){
    x.checked = false;
}else{
    x.checked = true;
}
}, 1000);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question