To play and mute the sound, you have .play()
and .pause()
, which is the on / off setting for .toggle()
.
You may also want to replace .toggleClass()
with .removeClass()
since you want it to stop in this case, not toggle.
$('.mute-the-music').click(function() {
$('#soundcloudbutton').removeClass('soundcloudplay');
widget.pause();
});