I have no idea how to change the colour of my element if the colour’s crimson to white. It has me confused because I’ve tried many solutions such as turning them into variables. Would anyone be able to tell me what I’m doing wrong, or possibly point me in the right direction? I’ve tried "duplicate" questions, but none of them really share the same issue.
<button class="btn-startcall10" onclick="recorda()"><i class="fa fa-wave-square"></i> </button>
function recorda() {
document.getElementsByClassName("fa-wave-square")[0].style.color = "crimson";
if () {}
}
You can use
Element.style.color
in the javascript to get the current color of the element.Then based on that color you can change the color of your element.
you can try something like this
https://jsfiddle.net/Lyuvf9a6/3/