var i = 0 setInterval(function(){ $('.btn').eq(i).trigger('click'); i++; if(i== $('.slide').length-1) i = 0; }, 6000);