Play Audio after loading - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:trigger

Description

Play Audio after loading

Demo Code

ResultView the demo in separate window

<html lang="en">
 <head> 
  <title>My audio test page</title> 
 </head> //from   w  ww  .  j  a v a  2  s  .c om
 <body> 
  <audio id="audio-cha-ching"> 
   <source src="http://your file.wav" type="audio/wav"> 
  </audio> 
  <p>You should hear a "ka-ching" noise.</p> 
  <script src="https://code.jquery.com/jquery-1.10.2.js"></script> 
  <script type="text/javascript">
      $(function(){
        $("#audio-cha-ching").trigger("play");
      });
    
      </script>  
 </body>
</html>

Related Tutorials