Simple Loop through array

Loop through array to infinity using javascript modulus

by blowsie

HTML

<div id="btn">Go</div>

CSS

#btn {width:100px; height:30px; background:#000; color:#fff; font: 'Arial' 30px; line-height:30px; text-align:center; margin:30px;}

JavaScript

var i = 0,
    abc = ['a', 'b', 'c'];
    
$("#btn").click(function(){
    $(this).text(abc[i % 3]);
    i++;
});