Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript play sound onclick

var audio = new Audio("soundfile.wav");

document.onclick = function() {
  audio.play();
}
Comment

sound on click javascript

<button onclick="playSound()">Play</button>

<script>
let playSound = () => new Audio("src.mp3").play();
</scirpt>
Comment

javascript click sound

<audio id="audio" src="http://www.soundjay.com/button/beep-07.wav" autoplay="false" ></audio>
<a onclick="playSound();"> Play</a>
<script>
  function playSound() {
  var sound = document.getElementById("audio");
  sound.play();
}
</script>
Comment

PREVIOUS NEXT
Code Example
Javascript :: Add Tailwind CSS to Svelte 
Javascript :: regex diferent of 
Javascript :: com.fasterxml.jackson.databind.exc.unrecognizedpropertyexception unrecognized field 
Javascript :: how to create a react app in current folder 
Javascript :: Convert underscore strings to camel Case 
Javascript :: socket io leave all rooms 
Javascript :: javascript oncontextmenu 
Javascript :: how to create an invite discord.js 
Javascript :: mongoose nullable 
Javascript :: axios jwt 
Javascript :: v-for vue 
Javascript :: settimeout function 
Javascript :: js how to hide an image 
Javascript :: gdscript add child node 
Javascript :: cypress scroll bottom 
Javascript :: javascript check if is array 
Javascript :: geolocation in javascript 
Javascript :: js exit fullscreen 
Javascript :: how to get element in iframe using javascript 
Javascript :: generate random 6 numbers in javascript 
Javascript :: javascript div id add class 
Javascript :: javascript get bit 
Javascript :: regex for lowercase letters js 
Javascript :: js array to object with keys 
Javascript :: sticky operations in javascript 
Javascript :: jquery first element 
Javascript :: React Native BUILD FAILED on run-ios 
Javascript :: jquery delete a cookie 
Javascript :: split string into equal chunks javascript 
Javascript :: how to access xpath in js 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =