HTML Audio/Video DOM ended Event

❮ HTML Audio/Video DOM Reference

Example

//Accessing the element
var vid = document.getElementById("myVideo");

//Creating a function
vid.onended = function() {
    alert("The video has been ended");
};

Meaning

The ended event run when the current playlist is ended.


Standard Syntax

HTML:

<element onended="myScript">

JavaScript:

object.onended=function(){myScript};

JavaScript, using the addEventListener() method::

object.addEventListener("ended", myScript);



Browser Support




Status







Technical Details

Type Description
Supported HTML tags: <audio> and <video>
Supported JavaScript objects: Audio, Video
❮ HTML Audio/Video DOM Reference