+ 2
Change of source file through js
does anyone know how to change the attribute value of src in audio tag through js
3 Answers
+ 1
const audioEl = document.getElementById('my-audio');
audioEl.setAttribute('src', 'my-track.mp3');
+ 1
I tried that but it didn't work
+ 1
You have to call audioEl.load(); after that, I suppose.