Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// 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