Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

play background music in html jasvascript

<audio src="https://www.bensound.com/bensound-music/bensound-moose.mp3"></audio>

<Script>
  window.addEventListener("DOMContentLoaded", event => {
    const audio = document.querySelector("audio");
    audio.volume = 0.2;
    audio.play();
  });
</Script>
Source by forum.freecodecamp.org #
 
PREVIOUS NEXT
Tagged: #play #background #music #html #jasvascript
ADD COMMENT
Topic
Name
1+3 =