title: JavaScript start new track when a different track is clicked
body: <p>I have this function: </p>
  
  <pre><code>function audioPlayer(band, album, track) {
      var audio = new Audio; //Class\
      audio.src = 'music/' + band + '/' + album + '/' + track + '.mp3';
      audio.play();
  }
  </code></pre>
  
  <p>It will play the song that is clicked. But when another song is clicked I'll hear both songs play.</p>
  
  <p>I have tried multiple suggestions already but none of them seem to work for me.
  I have tried:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/16362317/how-to-stop-one-audio-player-from-playing-when-i-click-another-javascript">How to stop one audio player from playing when I click another - javascript</a></li>
  <li><a href="https://stackoverflow.com/questions/14834520/html5-audio-stop-function">HTML5 Audio stop function</a></li>
  <li><a href="http://msdn.microsoft.com/en-us/library/ie/gg589489(v=vs.85).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ie/gg589489(v=vs.85).aspx</a></li>
  <li><a href="http://www.binarytides.com/stop-function-html5-audio-element/" rel="nofollow noreferrer">http://www.binarytides.com/stop-function-html5-audio-element/</a></li>
  </ul>
  
  <p>I don't use the html5 <code>&lt;audio&gt;</code> tag only JavaScript / jQuery.</p>
  
  <p>Is there a way to make the first song stop and than just play the other?</p>
  
  <p>If you need more information please let me know.
  Thanks in advance</p>