Last active
August 29, 2015 14:13
-
-
Save mapsam/3ff4ea824c2d5790337c to your computer and use it in GitHub Desktop.
loop through array to place as text
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>Code for America <br><span id="thing">FTW</span></h1></div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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