Question: I have an issue with an app I have made in javascript. When I click on something I want a sound to play. If I click this again I want the sound to start again. 

My issue is because the sound takes longer to play than it takes for me to click twice, each click doesn't start the sound.

To create a JSFiddle with my app would take a long time so Im just wondering if anyone could fix this issue using this JSFiddle : <http://jsfiddle.net/jamiehap/jtCA9/12/>

Basically i want to be able to keep clicking the play button and the sound will restart :)

Below is the code I'm using in the fiddle :)

```
     $(document).ready(function () {
          var audioElement = document.createElement('audio');
          audioElement.setAttribute('src', 'http://static1.grsites.com/archive/sounds/quotes/quotes006.mp3');
          audioElement.setAttribute('autoplay:false', 'autoplay');
          //audioElement.load code above. if you take out :false from the code the file will auto play than everythin works the same after that()
          $.get();
          audioElement.addEventListener("load", function () {
              audioElement.play();
          }, true);

          $(document).keypress(function (e) {
              if (e.which == 13) { //press enter the audio will play
                  audioElement.play();

              } else if (e.which == 32) { //press spacebar the audio will                             pause play
                  audioElement.pause();
              }
          });

// the code below wil allow you to click the play and stop button with the mouse
          $('.play-button').click(function () { 
              audioElement.play();
          });

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

```

Answer: 
Set the current time to zero before you call play

```
$('.play-button').click(function () {
    audioElement.pause();
    audioElement.currentTime = 0;
    audioElement.play();
});

```
Reload Audiofile before play:

```
$('.play-button').click(function () {
audioElement.load();
audioElement.play();
});

```