0
I wonder how I can change the text of the button every time I click on it, as if it were a list-group when click it opens and closes, I made this code:
function trocarFlecha()
{
var x = document.getElementById('btnImage').value;
if (x = "Imagem ˅") {
document.getElementById('btnImage').innerHTML = "Imagem ˂";
} else {
document.getElementById('btnImage').innerHTML = "Imagem ˅";
}
}
And added a onclick="trocarFlecha()"
on the button and it changes only once but I wanted to do it dynamically, making it every time I click it change.
And what is the text that should be displayed in the second click?
– Woss
@Andersoncarloswoss In the second click it would return to the original text, for example if the button is equal to Image and when clicked it will turn Video, when clicking again on the same button it turns Image again
– Churrozz
In his
if
, should bex == ...
, not onlyx = ...
.– Woss
I made the switch but it didn’t work even in the first click
– Churrozz