Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

HTML onended Event Attribute

  • Last Updated : 07 Aug, 2020

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.

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.


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


<!DOCTYPE html> 
        <h1 style="color:green">GeeksfroGeeks</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
  • Internet Explorer
  • Firefox
  • Apple Safari
  • Opera
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!