Advertisement
Home Open Editor ❯

HTML ondurationchange Attribute

Example

//Accessing the element
var vid = document.getElementById("myVideo");

//Creating a function
vid.ondurationchange = function() {
    alert("The video duration has changed");
};

Try this code ❯

Meaning

The durationchange event run when the duration of the audio/video is changed.


Standard Syntax

<element ondurationchange="script">


Applies to:

The ondurationchange attribute can be used on the following element:


Advertisement

Attribute Values

Value Description
script Specifies the script to be run on ondurationchange
Home Open Editor ❯
Advertisement