assigning source src with javascript help needed
Hi all,
i would like to populate this line:
<source src="audio/mysong1.mp3">
with the javascript var = song
but I am not sure the way to do this...
I tried this instead of the actual line (in the same area) - but it didn't work:
var t = document.createTextNode("<source src='audio/mysong2.mp3'>");
document.body.appendChild(t);
any suggestions are welcome - thanks
<script>
var song = "mysong2.mp3";
</script>
<div id="wrapper">
<audio preload="auto" controls>
<source src="audio/mysong1.mp3">
</audio>
</div>
