playing and switching between audio files using jquery
<p>I am trying to create a sort of radio switchboard.
For this i used a piece of javascript i found to switch between different radio stations in such a way that when i clicked on another radio, the previous one stopped. 
This worked for a while, but i couldn't find a way to have the radio re buffer the moment i clicked it. </p>

<p>Wanting tho change the code to jquery, i keep running into dead ends, and i can not get my code to work.
I would like to create it in such a way that you can switch between radio stations, but when you switch back, it reloads that specific audio file so that you keep the feeling of a "live" stream going.</p>

<p>An example of the html code:</p>

<pre><code>&lt;!-- row --&gt;
&lt;div class="row"&gt;
    &lt;!-- col  onClick="EvalSound('R538'); return false;" --&gt;
    &lt;div class="col-md-4"&gt;
        &lt;div class="stationcontainer"/&gt;
        &lt;div class="Studio"&gt;Radio 538&lt;/div&gt;
        &lt;div class="Player"&gt;
            &lt;audio id="R538"&gt;
                &lt;source src="http://vip-icecast.538.lw.triple-it.nl:80/WEB16_MP3" type="audio/mp3"&gt;
                Your browser does not support the audio element.
            &lt;/audio&gt;
        &lt;/div&gt;
    &lt;/div&gt;

    &lt;!-- col  onClick="EvalSound('Qmusic'); return false;" --&gt;
    &lt;div class="col-md-4"&gt;
        &lt;div class="stationcontainer"/&gt;
        &lt;div class="Studio"&gt;Q Music&lt;/div&gt;
        &lt;div class="Player"&gt;
            &lt;audio id="Qmusic"&gt;
                &lt;source src="http://icecast-qmusic.cdp.triple-it.nl:80/Qmusic_be_live_96.mp3" type="audio/mp3"&gt;
                Your browser does not support the audio element.
            &lt;/audio&gt;
        &lt;/div&gt;
    &lt;/div&gt;

    &lt;!-- col  onClick="EvalSound('TopRadio'); return false;" --&gt;
    &lt;div class="col-md-4"&gt;
        &lt;div class="stationcontainer"/&gt;
        &lt;div class="Studio"&gt;Top Radio&lt;/div&gt;
        &lt;div class="Player"&gt;
            &lt;audio id="TopRadio"&gt;
                &lt;source src="http://lb.topradio.be/topradio.mp3" type="audio/mp3"&gt;
                Your browser does not support the audio element.
            &lt;/audio&gt;
        &lt;/div&gt;
    &lt;/div&gt;

&lt;/div&gt;
</code></pre>

<p>The Javascript i used to use:</p>

<pre><code>    //switch between radio stations
    var currentPlayer;

    function EvalSound(soundobj) {


        //turn off when selecting another player
        var thissound = document.getElementById(soundobj);

        if (currentPlayer &amp;&amp; currentPlayer != thissound) {
            currentPlayer.pause();
        }
        if (thissound.paused) 
            thissound.play();

        else thissound.pause();

        thissound.currentTime = 0;
        currentPlayer = thissound;
    }
</code></pre>

<p>and a test jquery i am trying to get started
        //when ready
        $(function () {</p>

<pre><code>        //test
        $('.stationcontainer').click(function () {

            //get current audio id
            var thissound = $(this).find('id');

            thissound.play();

        });

    });
</code></pre>