<audio onended="myFunction()"> - Javascript DOM Event

Javascript examples for DOM Event:onended


The onended event occurs when the audio/video has reached the end.


Bubbles No
Cancelable No
Supported HTML tags: <audio> and <video>

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<audio controls onended="myFunction()">
  <source src="your.ogg" type="audio/ogg">
  <source src="your.mp3" type="audio/mpeg">
  Your browser does not support the audio element.
</audio>/*from w ww  .  ja v  a  2s .  co m*/

function myFunction() {
    console.log("The video has ended");


Related Tutorials