<ul>
<li></li>
<li></li>
<li></li>
</ul>
$(function() {
let elems = $('ul li');
$(elems).each(function(index, val){
setInterval(function(){
$(elems[index]).click();
}, 2000)
});
});
$(document).ready(() => {
const $items = $("ul li")
const l = $items.length - 2
let i = -1
let interval = setInterval(() => {
i = i < l ? i + 1 : -1
$items.eq(i).trigger("click.real")
}, 1000)
$items.one("click", () => {
clearInterval(interval)
}).on("click.real", function() {
console.log("real click')
})
})