Jhonatan Rico Jhonatan Rico - 5 months ago 34
Javascript Question

Click a different button after clicking a button

I'm trying to auto-click a button in a page, but only after I manually clicked it first, the problem is that when the page loads, immediately the button starts to click and I need that it starts to click just after I make the first click

var $button = $('#start_autobet');
var maxWait = 3000;

function autoBet(){

setTimeout(function() { autoBet();}, getRandomWait());

I don't know how to make it start just after clicking.


This should work for you:

$('#start_autobet').on('click', function() {