Skip to content
Related Articles
Open in App
Not now

Related Articles

HTML onended Event Attribute

Improve Article
Save Article
  • Last Updated : 07 Sep, 2022
Improve Article
Save Article

The HTML onended Attribute is a event attribute which works when the audio/video is ended. We can add some custom message in this event like “Thank for watching”, “Share”, etc. 

Usage: This attribute is used in <audio> and <video> element.


<element onended="myScript">
  • Attribute Value: This attribute contains single value script which works when onended event attribute call.



<!DOCTYPE html>
        <h1 style="color:green">GeeksforGeeks</h1>
        <h2>HTML onended Event Attribute</h2>
        <audio controls onended="gfgFun()">
            <source src="beep.mp3" type="audio/mpeg">
            function gfgFun() {
                alert("Thanks for listning");



Supported Browsers:

  • Google Chrome 3
  • Edge 12
  • Internet Explorer 9
  • Firefox 3.5
  • Apple Safari 3.1
  • Opera 10.5
My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!