I have a problem with javascript, but for lack of language knowledge.
Javascript:
<script>
function PlayerRoduzir(id) {
var id;
change("https://api.xxxxxx.com/tracks/" + id +".mp3");
var button1 = document.getElementById("play_" + id).style.display = "none";
var button2 = document.getElementById("stop_" + id).style.display = "";
}
function PlayerParar(id){
var id;
var audio = document.getElementById("player");
var source = document.getElementById("mp3_src");
var button1 = document.getElementById("play_" + id).style.display = "";
var button2 = document.getElementById("stop_" + id).style.display = "none";
audio.pause();
}
</script>
PHP / HTML:
<?php
echo "<button type='button' id='play_".$id."' onClick='PlayerRoduzir(".$id.");' class='btn btn-info'><i class=\"fa fa-play-circle-o\" aria-hidden=\"true\"></i></button> ";
echo "<button type='button' style='display: none;' id='stop_".$id."' onClick='PlayerParar(".$id.");' class='btn btn-danger'><i class=\"fa fa-stop\" aria-hidden=\"true\"></i></button> ";
?>
When I click on the play button, it will turn red with the STOP sign to stop, if I click on the player.
The problem is when I click the other "play", the other buttons should turn blue, but it does not turn red, I would like it to turn blue and red only in the song that is playing. Here's the example of how you're currently in the image below:
And so, how to fix this?