So I have a php foreach loop as follows,
$i = 1;
foreach($rows as $record){
<div id='ytplayer".$i++."'>
</div>");
}
and then I have javascript which uses the getElementById and it needs to get the div everytime it is looped, which would essentially be an array, but how would I do that, I know what I have below wont work, but something like this, since I know this is pretty close to how you would get this to work in php
document.getElementById('ytplayer[i]');
Here you go!
http://jsfiddle.net/epinapala/5yUAx/
Assuming that your PHP writes the following divs(one,two etc are added for example sake…)