I have a bit of javascript which runs like this:
document.getElementById("audio").innerHTML = ("<audio id=\"player\" src=\"data:audio/x-wav;base64,"+encode64(wav)+"\">");
return document.getElementById("player");
I would like to change it to something like this:
audio = document.createElement("audio");
audio.src = "data:audio/x-wav;base64,"+encode64(wav)+"\">";
document.body.appendChild(audio);
return audio;
But, this does not work in the same way. Why is this not essentially equivalent in returning an element with a play method?
The
srcshould not have the close tag part: