0

On click audio

I am working on an alphabets kid learning website, and want to play a sound on clicking an image. e.g. if user clicks on A(image) then in background sound of pronunciation of A must be played. Can it possible without using java script? If no Could anyone help?

16th May 2020, 12:02 AM
Muhammed Suhail
Muhammed Suhail - avatar
2 Answers
+ 1
Yes it is possible just add your audio to your webpage . And then make a button with onclick attribute by which you want to play your audio . And use js to play it on clicking. Ex <audio id="myAudio"> <source src="horse.ogg" type="audio/ogg"> </audio> <button onclick="playAudio()" type="button">Play Audio</button> <script> var x = document.getElementById("myAudio"); function playAudio() { x.play(); } </script>
16th May 2020, 12:18 AM
Ayush Kumar
Ayush Kumar - avatar
0
tax bro...
16th May 2020, 4:15 PM
Muhammed Suhail
Muhammed Suhail - avatar