``` More examples are included at the bottom of this"> ``` More examples are included at the bottom of this" />
Easy Tutorial
❮ Prop Password Type Jsref Valueof String ❯

onended Event

Event Object

Example

Execute JavaScript when the audio has ended playing:

<audio onended="myFunction()">

More examples are included at the bottom of this page.


Definition and Usage

The onended event is triggered when the video/audio (audio/video) has finished playing.

This event is commonly used to display messages like "Thank you for watching."


Browser Support

The numbers in the table specify the first browser version that fully supports the event.

Event Chrome IE Firefox Safari Opera
onended Yes 9.0 Yes Yes Yes

Syntax

In HTML:

In JavaScript:

In JavaScript, using the addEventListener() method:

Note: The addEventListener() method is not supported in Internet Explorer 8 and earlier versions.


Bubbles: No
Cancelable: No
--- ---
Event type: Event
--- ---
Supported HTML tags: <audio>, <video>
--- ---

More Examples

Example

Execute JavaScript when the video has ended playing:

<video onended="myFunction()">

❮ Prop Password Type Jsref Valueof String ❯