Skip to content

Instantly share code, notes, and snippets.

@karla001
karla001 / script.js
Last active June 27, 2022 05:16
Used to mute and unmute an HTML <audio> tag when mute button was clicked.
function sound(){
$mutebutton.on('click',function(event) {
if($audio[0].muted === false){
$audio.attr('muted',true)
$audio[0].muted = true;
$mutebutton.text('Unmute');
console.log('Muted');
}else if($audio[0].muted === true){
$audio.removeAttr('muted')
$audio[0].muted = false;