JavaScript – Change the Background Color of Paragraph
To change the background color of a paragraph using JavaScript, get the reference to the element, and assign the specific color to the element.style.backgroundColor
property.
index.html
Conclusion
In this JavaScript Tutorial, we learned how to change the background color of a paragraph using JavaScript.