+ 2

Playing Sound In Hidden Tag

I am trying to set sound on web page. I found this code. It is working code when theĀ divis visible but I want to be hidden and working. In this case it is not working because it is hidden withĀ styleĀ attribute. How to make it not visible and playing sound at the same time ? <div id="boxaudio"> <audio autoplay controls src="https://dl.dropbox.com/s/5ovdp8z2300kv6f/LoveParadiseBeat-KellyChen_39rhu.mp3?raw1" type="audio/mp3"> </audio> </div>

25th Feb 2018, 1:25 PM
Michelangelo
Michelangelo - avatar
3 Answers
+ 2
It seems that you are trying on SoloLearn/CodePen. I tried it on my Notepad editor and it runs well in Chrome/Safari/Mozilla. Try the above code on Desktop, I am sure it will work! Here is why your code failed to work: https://code.sololearn.com/W2pvfgtyZvS3/?ref=app
27th Feb 2018, 8:04 AM
777
777 - avatar
0
By removing the "controls" attribute from audio tag, you're done!
26th Feb 2018, 6:01 PM
777
777 - avatar
0
thanks blue I did try that just now and the I am still having an issue. The player is hidden like I wanted but it doesn't auto play in the background. the mp3 in the link does work so that can't be the problem.
26th Feb 2018, 7:04 PM
Michelangelo
Michelangelo - avatar