JSFiddle - React, Tailwind, and code Playground

by Ken Z

HTML

<div>
    <p class="song"><h3><strong>#1 Intro - The Oath</strong></h3><p>
        <audio class="playback" src=http://geo-samples.beatport.com/lofi/5005876.LOFI.mp3 controls='controls' preload="none">
            <I>Your browser does not support the audio element.</I>
        </audio>
        </div>
        <div>
            <p class="song"><h3><strong>#2 A State Of Trance Year Mix 2013</strong></h3></p>
            <audio class="playback" src=http://geo-samples.beatport.com/lofi/5005933.LOFI.mp3 controls='controls' preload="none">
                <I>Your browser does not support the audio element.</I>
            </audio>
        </div>

JavaScript

$("audio").on("play", function() {
    $("audio").not(this).each(function(index, audio) {
        audio.pause();
    });
});