Created
May 8, 2012 21:38
-
-
Save ebonneville/2639544 to your computer and use it in GitHub Desktop.
This file contains 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
// get the element we want | |
var myElement = document.getElementById("myElement"); | |
// get its inner HTML and put it in an array | |
var myInnerHTML = [myElement.innerHTML]; | |
for(var i = 0; i < 10; i++) { | |
// add a string to the end of the myInnerHTML array | |
myInnerHTML.push("some value"); | |
} | |
// join the array | |
myInnerHTML = myInnerHTML.join(""); | |
// reassign the element's inner html | |
myElement.innerHTML = myInnerHTML; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment