JSFiddle - React, Tailwind, and code Playground

by Sebastian Kay

HTML

<div class="play">Play</div>

<div class="pause">Stop</div>

JavaScript

$(document).ready(function() {
        var audioElement = document.createElement('audio');
        audioElement.setAttribute('src', 'http://ueberflie.ga/Alarm08.wav');
        audioElement.setAttribute('autoplay', 'autoplay');
        //audioElement.load()
        $.get();
        audioElement.addEventListener("load", function() {
        audioElement.play();
        }, true);




        $('.play').click(function() {
        audioElement.play();
        });


        $('.pause').click(function() {
        audioElement.pause();
        });



});