Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

HTML | DOM Audio load() Method

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

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

 


My Personal Notes arrow_drop_up
Last Updated : 30 Mar, 2021
Like Article
Save Article
Similar Reads
Related Tutorials