I've currently got some javascript that uses document.write to repeat the same div with slight changes every time. However, I feel Jquery could be a much better way of doing this for the code I'm using.
However, reading through Jquery tutorials have been great, but I can't bring my head around how to recreate this!
Can someone help me piece this together in Jquery?
Code:
<script type="text/javascript">
var g=1;
while (g<=44)
{
document.write("<div id=\"selection\">");
document.write("<a class=\"playback\" href=\"#\">");
document.write("<img id=\"play\" src=\"images/");
document.write(g);
document.write(".jpg\" />");
document.write("</a>");
document.write("<audio id=\"a");
document.write(g);
document.write("\">\">");
document.write("<source src=\"audio/");
document.write(g);
document.write(".mp3\" type=\"audio/mpeg\" />");
document.write("Your browser does not support HTML5 audio.");
document.write("</audio>");
document.write("</div>");
g++;
}
</script>
However, reading through Jquery tutorials have been great, but I can't bring my head around how to recreate this!
Can someone help me piece this together in Jquery?