Question

Is it possible to emulate a Click on a Link or any Tag at a set Interval ?

Reason: I have a plugin that doesnt have auto Rotate Feature but works only on click of the Next and Prev Link. So i am trying to write a function that does the clicking automatically.

Was it helpful?

Solution

You can use setInterval to repeatedly call a function and fire click event within that function using trigger or directly call click().

setInterval(function(){
  $('#ElementId').trigger('click');
 // $('#ElementId').click();
}, 5000);

OTHER TIPS

var checkForConfirmation = function(){
      $("#anchorLink").trigger('click');
}
var checkInterval = setInterval(function(){checkForConfirmation()}, 5000);
setInterval(function(){
  $('#ElementId').click();
}, 5000);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top