Latest web development tutorials

onended event

Event Object Reference Event objects

Examples

After the end of the audio player to perform JavaScript:

<Audio onended = "myFunction ()">

try it"

Bottom of this article contains more examples.


Definition and Usage

onended event is triggered at the end of play in the video / audio (audio / video).

This event is often used to send something like "Thank you for watching" like the message.


Browser Support

Figures in the table represent the first browser to support this version of events.

event
onended Yes 9.0 Yes Yes Yes


grammar

In HTML:

<Elementonended = "myScript"> try

In JavaScript:

object .onended = function () {myScript }; try

JavaScript, use the addEventListener () method:

object .addEventListener ( "ended", myScript ); try

Note: Internet Explorer 8 and earlier versions of IE do not support addEventListener () method.


technical details
Whether to support the bubble: No
It can be canceled: No
Event Type: Event
Supported HTML tags: <Audio>, <video>


Examples

More examples

Examples

When the video has finished implementation of JavaScript:

<Video onended = "myFunction ()">

try it"


Event Object Reference Event objects