+ 1
How can I make a button to be auto click using setTimeout in JAVASCRIPT?
I want to make a button to be auto clicked after a particular period. I have not any idea to perform the task. Please tell me how can I do?
1 Antwort
+ 1
setTimeout(() => button.click(),delay);
where 'button' should hold a reference to the targeted <button> element and delay is the time in millisecond after when the callback function will be called...
reference to html element (in the DOM) could be retrieved from many ways, among wich getElementById or querySelector ;)