I’m trying to print a array to a particular id in my page. I have the array print out just fine but cannot figure out how to get it to print to that id.
This Prints what i want out:
for(var i=0;i<playerCards.length;i++){
document.write('<img src="images/cards/card-' + playerCards[i] + '.jpg" width="58" height="79" alt="playercards" /> ');
}
I’m trying to get it to work like this:
document.getElementById("player").innerHTML="THE ABOVE LOOP";
I have tried combining to two and moving things around but cant seem to figure out how to print it out. Thanks!
1 Answer