Вопрос

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.

Это было полезно?

Решение

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);

Другие советы

var checkForConfirmation = function(){
      $("#anchorLink").trigger('click');
}
var checkInterval = setInterval(function(){checkForConfirmation()}, 5000);
setInterval(function(){
  $('#ElementId').click();
}, 5000);
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top