Example:
HTML
<audio id="myAudio" controls onended="myFunction()">
<source src="https://download.samplelib.com/mp3/sample-3s.mp3" type="audio/ogg">
<source src="https://download.samplelib.com/mp3/sample-3s.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<p>Play the audio file:</p>
<script>
function myFunction() {
alert("Thank you for listening");
}
</script>
How to Run "myFunction" when the audio has finished playing | HTML Attribute |
How to Run "myFunction" when the video is finished | HTML Attribute |
Type: | Html |
Category: | Web Tutorial |
Sub Category: | HTML Attribute |
Uploaded by: | Admin |