Skip to content
Related Articles

Related Articles

HTML | DOM Audio load() Method
  • Last Updated : 30 Mar, 2021
GeeksforGeeks - Summer Carnival Banner

The Audio load() method is used for reload the audio element. The Audio load() method is used to update the audio element after changing the source or other settings. The Audio load() method does not accept any parameters and does not return any values.
Syntax 
 

audio.load()

Example: 
 

html




<!DOCTYPE html>
<html>
 
<body style="text-align:center;">
     
    <h1 style="color:green">GeeksforGeeks</h1>
     
    <h2>HTML DOM Audio load() Method</h2>
     
    <button onclick="my_Audio()" type="button">
        Change Audio
    </button>
    <br>
 
    <audio id="my_Audio" controls autoplay>
        <source id="mp4_src" src=
                    type="audio/mp3">
 
        <source id="ogg_src" src=
                    type="audio/ogg">
    </audio>
 
    <script>
        function my_Audio() {
            document.getElementById("ogg_src").src =
         
            document.getElementById("mp4_src").src =
 
            document.getElementById("my_Audio").load();
        }
    </script>
</body>
 
</html>

Output: 
 

Supported Browsers: The browsers supported by HTML DOM Audio load() Method are listed below: 
 

  1. Google Chrome
  2. Opera
  3. Mozilla Firefox

 

full-stack-img




My Personal Notes arrow_drop_up
Recommended Articles
Page :