Problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Problem

https://code.sololearn.com/W8C62k2JZb7d/?ref=app I have made this code and I want to add sound to it That whenever I click it makes a noise Please help

22nd Nov 2022, 2:06 PM
Ahmed Jakir
Ahmed Jakir - avatar
6 Answers
+ 3
There is no playSound() function defined? If you would like to play the sound in clicking wouldn't it be better to keep the user on this site instead of redirecting them to YouTube?
22nd Nov 2022, 3:07 PM
Lisa
Lisa - avatar
+ 3
I am guessing you don't understand rick-rolling or what your code is supposed to do.
22nd Nov 2022, 4:10 PM
Lisa
Lisa - avatar
+ 3
So the audio should start on clicking? What happens if the user clicks again while the audio is already playing? I think, you could attach the play-function to a button element. You could try to hide the audio element. I just found this lesson on sololearn: https://www.sololearn.com/learn/HTML/2193/?ref=app
22nd Nov 2022, 4:36 PM
Lisa
Lisa - avatar
+ 1
Btw can you write the code for the sound thingy? (Also the youtube link is temporary)
22nd Nov 2022, 4:31 PM
Ahmed Jakir
Ahmed Jakir - avatar
+ 1
Thank you for your help!
22nd Nov 2022, 4:40 PM
Ahmed Jakir
Ahmed Jakir - avatar
0
I am guessing that you got rick rolled!
22nd Nov 2022, 3:20 PM
Ahmed Jakir
Ahmed Jakir - avatar