Advertisement
Home Open Editor ❯

HTML onended Attribute

Example

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

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

Try this code ❯

Meaning

The ended event run when the current playlist is ended.


Standard Syntax

<element onended="script">


Applies to:

The onended attribute can be used on the following element:

Element Attribute
<audio> onended
<video> onended

Advertisement

Attribute Values

Value Description
script Specifies the script to be run on onended.
Home Open Editor ❯
Advertisement