var playBtn = document.getElementById('play'); var stopBtn = document.getElementById('stop'); var playSound = function() { audio.play(); }; playBtn.addEventListener('click', playSound, false); stopBtn.addEventListener('click', function(){audio.pause()}, false);
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter