Run
Back to
HTML onplaying Event Attribute
<!DOCTYPE HTML> <html> <body> <audio id="myAudio" controls onplaying="myFunction()"> <source src="audio.mp3" type="audio/mpeg"> Your browser does not support the audio tag. </audio> <p>Play sound file.</p> <script> function myFunction() { alert("EXAMPLE: Sound file started playing."); } </script> <p>This example shows how to use the onplaying attribute for an AUDIO element.</p> </body> </html>