Exercise:
Use the HTML DOM to set the text color of <p> to "red".
Hint
Hint:
element
.style.color = "
color
"
Edit This Code:
See Result »
<!DOCTYPE html> <html> <body> <p id="demo">Hello World!</p> <script> // Add code here </script> </body> </html>
Result:
Show Answer
Correct Code:
<!DOCTYPE html> <html> <body> <p id="demo">Hello World!</p> <script> document.getElementById("demo").style.color = "red"; </script> </body> </html>
Correct Result:
Hide Answer
Privacy Policy