Change the text of both buttons upon clicking

Hi I am trying to change the text of both buttons upon clicking:

Thank you.

You could do that using a loop to change the text of one element at a time …

function changeText()
  let reverseImage = document.getElementsByClassName("reverseImage"); 
  for (let element of reverseImage) {  // do stuff for each element in the collection
    if(element.innerHTML == "View Reverse Plan"){
        element.innerHTML = "View Original Plan"; }
        element.innerHTML = "View Reverse Plan"; }

Notice that document.getElementsByClassName gives you a collection of elements, not a single element.
So reverseImage has no .innerHTML because its a collection, not an HTML element.
But you can loop through the collection to set the .innerHTML of each element (one on each iteration).

1 Like

Thank you so much. You have been a big help and have been learning so much from your explanations. Thank you.