How to click a browser button with JavaScript automatically? How to click a browser button with JavaScript automatically? javascript javascript

How to click a browser button with JavaScript automatically?


setInterval(function () {document.getElementById("myButtonId").click();}, 1000);


This will give you some control over the clicking, and looks tidy

<script>var timeOut = 0;function onClick(but){    //code    clearTimeout(timeOut);    timeOut = setTimeout(function (){onClick(but)},1000);}</script><button onclick="onClick(this)">Start clicking</button>


document.getElementById('youridhere').click()