HTML onended Attribute

❮ HTML Attributes

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

<element onended="script">



Browser Support




Status




Applies to:

The onended attribute can be used on the following element:

Element Attribute
<audio> onended
<video> onended






Attribute Values

Value Description
script Specifies the script to be run on onended.
❮ HTML Attributes