html tutorial - onended Attribute in HTML - html5 - html code - html form




Onended attribute in html

Learn html - html tutorial - Onended attribute in html - html examples - html programs

  • The onended event triggers when the audio/video has been ended.
  • The onended attribute is a section of the Event Attributes.

Syntax for onended attribute in HTML:

<element onended=”script”>

Applies To:

Elements Attribute
<audio> onended
<video> onended

onended Attribute Value:

Value Description
script The script can run on onended.

Sample Coding for onended Attribute in HTML:

Tryit<!DOCTYPE html>
<html>
    <head>
        <title>Wikitechy onended attribute</title>
    </head>
    <body>
        <video width="320" height="240" controls onended="onEnded()">
           <source src="hibiscus.mp4" type="video/mp4">
        </video>
        <script>
          function onEnded() 
          {
            alert("Thank you for Watching Wikitechy video");
          }
        </script>
    </body>
</html>

Code Explanation for onended Attribute in HTML:

onended Attribute Code Explanation

  1. <video> tag is used to embed a video file in the HTML Document.
  2. The onended attribute is used to call onEnded() JavaScript function when the video reaches its end.
  3. The JavaScript function onEnded is used to display an alert message.

Output for onended Attribute in HTML:

onended Attribute Output

  1. The video file has been displayed.
  2. onended Attribute Output
  3. After ending the video, the alert box display the message as “Thank you for Watching Wikitechy video”.

Browser Support for onended Attribute in HTML:

Yes Yes Yes Yes Yes

Related Searches to onended Attribute in html

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add wikitechy.com to your ad blocking whitelist or disable your adblocking software.

×