0

Can't work out how to change the color of this with out placing a color attribute in the tag. I want to change the color of the word "Correct!"

if (Number(array1[i].value) == ((i+1) * number)){ array2[i].innerHTML = "Correct!"; } 
3
  • what about array2[i].innerHTML = "<span style='color: red'>Correct!</span>"; Commented Sep 13, 2018 at 11:51
  • ChrisLi you're a bloody legend mate! Commented Sep 13, 2018 at 11:55
  • 1
    Possible duplicate of Change text color with Javascript? Commented Sep 13, 2018 at 12:02

1 Answer 1

2

Maybe this?

array2[i].style.color = "blue"; 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.