Crkva Kovacica Crkva Kovacica - 1 year ago 68
Javascript Question

Why isn't my audio player visible, and how can i fix it?

I made a playlist of songs with my

tags, and i made a player, so when i click the item from list the player plays the song, but i can't see the player and control it, how can this be fixed, so i can see the player and still choose the song from the list? (I did not style the audio player...)

Here is my HTML:

<audio preload="auto" src="#" autoplay="true"></audio>

<a class="trigger" href="#" data-src="audio/song1.mp3">Song #1</a>
<a class="trigger" href="#" data-src="audio/song2.mp3">Song #2</a>
<a class="trigger" href="#" data-src="audio/song3.mp3">Song #3</a>
<a class="trigger" href="#" data-src="audio/song4.mp3">Song #4</a>

And the JQUERY i used for changing the source from audio tag

$('.trigger').on('click', function () {
$('audio').prop('src', $(this).data('src'));

Answer Source

Write this :

<audio preload="auto" src="#" autoplay="true" controls></audio>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download