Script to automatically trigger button after x seconds


I was looking for a scrip ich could implement to trigger a button automatically every 3 seconds.

I found this on stack overflow: javascript - script - click button every x seconds - Stack Overflow

<input type="submit" name="Submit" id="but" value="Puxar Alavanca">

    var but = document.querySelector("[name='Submit']");
    setInterval(function () {;},3000);

But I can’t make it work. How do I give my button the id “but” like in the example?

Can anybody help?

To set the id, select it in the designer, and set the ID at the top of the settings tab.

However you are not using that id in your script. To target the element using it, change this line;

var but = document.querySelector("[name='Submit']");


var but = document.getElementById("but");
1 Like