How to automatically click with javascript

Asked

Viewed 46 times

0

I would like you to help me in creating a javascript function so that, when loading a page, a button is automatically clicked every X seconds.

I tried to do this function but did not succeed and edited the text here in order to be better understood.

Logic:

When loading the page, a button should be clicked every X seconds.

Thank you very much for your personal attention.

  • You want when you click the button to be called the function animaCarrosel?

  • Exact. In this script I presented, the anima carrosel function changes only one div for another with images doing the replacements automatically. The idea of the function I need is to do "clicks" every X seconds on a button.

  • then you don’t need to "click" on anything, just call the function from time to time: setInterval(animaCarrosel, 3000);. Will perform the function every 3 seconds.

  • I’m sorry, but I don’t think I made myself clear. Let me try to be assertive: This function I presented has the pattern I thought about at the level of image exchange without the need to click. I would like you to help me in a new function, which basically gives me the automatic action of clicking on a button every X seconds within a page. In this case my script was only presented to show where I was at the time of the attempt. Now, I think the idea would be to create a new function, this in turn with action on a button when loading the page. See if it’s clear because my intention is to be assertive.

  • Unfortunately you could not be assertive. I recommend editing the question and be clearer.

  • I edited the question friend. See if it was cleaner and clear. Thanks for the tip.

  • Here’s an example https://stackoverflow.com/questions/39110102/trigger-mouse-clickon-a-button-each-5-seconds

  • Our friend, really enlightened me on how to do it. Thanks for the tip. I managed a function based on that that presented me as an example and worked perfectly. Now I’m going to another venture that is to 'reset' the carousel at the end, but I believe that I will not have difficulty. Thank you very much for your help!

Show 3 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.