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