title: Javascript Repeating Audio
body: <p>I have been trying to get this JavaScript to repeat the audio once it has finished, I have had a look around and I am inexperienced with JavaScript, although I have made attempts tweaking and researching I have had no luck so far.</p>
  
  <p>I would be very grateful for any help and tips</p>
  
  <p>Many thanks- Grant</p>
  
  <pre><code>&lt;!-- Script inside body --&gt;
  
      &lt;!-- Audio Player --&gt;
          &lt;script&gt;
          $(document).ready(function() {
          var audioElement = document.createElement('audio');
          audioElement.setAttribute('src', 'music/audio.mp3');
          audioElement.setAttribute('play', 'autoplay');
          //audioElement.load()
          $.get();
          audioElement.addEventListener("load", function() {
          audioElement.play();
          audioElement.loop();
          }, true);
  
  
          $('.play').click(function() {
          audioElement.play();
          });
  
  
          $('.pause').click(function() {
          audioElement.pause();
          });
  
      });
          &lt;/script&gt;
  
         &lt;div class="play"&gt;Play&lt;/div&gt;
         &lt;div class="pause"&gt;Stop&lt;/div&gt;
  </code></pre>