Javascript, change colour of element on-click with if-statement

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 () {}

139 thoughts on “Javascript, change colour of element on-click with if-statement”

Leave a Comment