0

i trying to play a sound file when i click the button, but it's not working in Firefox but its works great in chrome, my html code is :

<html> <body> <div id="container">
<button id="play">Play Music</button> </div> </body> </html>

My Scripting:

$(document).ready(function() {

var audioElement = document.createElement('audio'); audioElement.setAttribute('src', 'Bullet.mp3');

$('#play').click(function() { audioElement.play(); }); });

Thanks in advance

4

0 回答 0