Skip to content

Instantly share code, notes, and snippets.

@mapsam
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mapsam/3ff4ea824c2d5790337c to your computer and use it in GitHub Desktop.
Save mapsam/3ff4ea824c2d5790337c to your computer and use it in GitHub Desktop.
loop through array to place as text
<h1>Code for America <br><span id="thing">FTW</span></h1></div>
$(document).ready(function(){
var t = document.getElementById('thing');
var phrases = [
'FTW',
'does maps!',
'fights the good fight.',
'#freedom',
'<3'
];
var count = 1;
setInterval(function(){
console.log(phrases[count]);
t.innerHTML=phrases[count];
count++;
if(count>=phrases.length) {
count=0;
}
}, 1000);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment