JSFiddle - React, Tailwind, and code Playground

by BandonRandon

HTML

<span id="dummy" onclick="playSound(this, 'http://bandonrandon.com/willpower.mp3');">
    <img src="http://placehold.it/350x150" name="Bottom-1" width="115" height="45" border="0" id="Bottom-1"/>
</span>

JavaScript

function playSound(el,soundfile) {
    if (el.mp3) {
        if(el.mp3.paused) el.mp3.play();
        else el.mp3.pause();
    } else {
        el.mp3 = new Audio(soundfile);
        el.mp3.play();
    }
}