How do I manipulate CSS colors with JavaScript?
Ricardo V.
answered 09/20/19
Senior Front-end Engineer
You could get the reference to the element that you want to change the color and then modify its style.
e.g.:
document.getElementById("mainHeader").style.color = "#f0f0f0";
Still looking for help? Get the right answer, fast.
OR
Find an Online Tutor Now
Choose an expert and meet online.
No packages or subscriptions, pay only for the time you need.