+ 1
How to change text color?
How to make sure that when you click on different buttons, the color of the text changes differently? And if possible, can this be done as an example? Example: function RedBg() {document.bgColor = 'red';}
4 Answers
+ 2
For example:
<h1>My Text Color</h1>
<button onclick="body.style.color = 'red'">Click to red!</button>
<button onclick="body.style.color = ''">Click to default!</button>
+ 1
Look how my code works, I need such a result, only with text.
+ 1
Yes, thank you very much!
0
Another solution will be as follows:
function GreenBg() {document.querySelector("body").style.color = 'green';}