+ 4
How To Play Audio In Javascript?
hmm... maybe i see a question like this before... but i can't find it... so i post a new question i want to make audio play when the screen is clicked
7 Answers
+ 10
var music = new Audio(URL for audio here);
document.body.onclick = function() {
music.play();
};
+ 4
jelger.js I want to play audion in JAVASCRPT
+ 4
JiŠæŠ±Š±Š° SŠ¾nŠ° do you want to trigger play audio using js or you want to play audio without html audio tag
+ 4
jelger.js yes,
1.createElement "audio" by js
2.set src attribute of audio tag and set value of src
+ 3
Amir Ahmad i want to make audio play when we tap the screen...
+ 3
Rowsej
thannks a lot rowsej!
sorry i didnt noticed this beforeš
š
š
THANKS!
+ 2
jelger.js did you mean accesing HTML?