I need the button to change color every time I clicked, I used the focus but it does not bring me the expected result, because after the button is clicked, the user needs to click on another corner, so the background color back to normal.
<div class="container">
<div class="row">
<div class="col-sm">
<button type="button" class="btn btn-primary bot-click" id="E" onclick="botaoClicado(this.id)" value="Red">CASA FECHADA</button>
</div>
<div class="col-sm">
<button type="button" class="btn btn-primary bot-click" id="D" onclick="botaoClicado(this.id)" value="Red">ENDEREÇO NÃO LOCALIZADO</button>
</div>
<div class="col-sm">
<button type="button" class="btn btn-primary bot-click" id="G" onclick="botaoClicado(this.id)">CLIENTE REAGENDOU</button>
</div>
</div>
</div>
There are these buttons, and the user can click on a button, but he can change of choice and click on another, in that the color of the previous one clicked should return to normal and the new click changed color.
JS
var bot = window.idBotaoClicado
function botaoClicado(e) {
bot = e
document.querySelector('.bot-click').style.background = 'Red'
}
I made this code, but for some reason it always ends up getting the button clicked and also the first button.