odayo's avatar
Level 1

How to use foreach loop with audio tag

I'm working with playing a playlist of audios from stored in the database with a single pause and play button. I found a nice Jquery code to use but the issue is that only the first music played

How can I make the id dynamic? for perfect function

{{$ebeat->title}}

var myAudio = document.getElementById("{{$ebeat->id}}"); function togglePlay() { return myAudio.paused ? myAudio.play() : myAudio.pause(); };
0 likes
0 replies

Please or to participate in this conversation.