I need to make it so that by clicking on <a>Музыка</a> , the audio stream starts playing

I know that there is a <bgsound> but it plays music when the page loads.

    1 answer 1

    Something like this

     const button = document.getElementById("button"); const audio = document.getElementById("audio"); button.onclick = function() { audio.play(); } 
     <a id='button'>Музыка</a> <audio id="audio" src="https://www.w3schools.com/html/horse.mp3"> </audio>