Last active
June 5, 2020 17:59
-
-
Save sashadev-sky/48920de7fc118bca7ac115752414444f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// app/assets/javascripts/beeper.js | |
const audio = new Audio('http://soundbible.com/grab.php?id=1815&type=mp3'); | |
document.addEventListener('click', (event)=>{ | |
let el = event.target; | |
if (el.matches('.beeper')) { | |
console.log("beep!"); | |
audio.play(); | |
el.classList.toggle("disabled"); | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment