![change color of button text html change color of button text html](https://www.techonthenet.com/excel/questions/images/cond_format1_2010_004.gif)
Let btnGreen = document.querySelector('#btnGreen')
![change color of button text html change color of button text html](https://d33v4339jhl8k0.cloudfront.net/docs/assets/5915e1a02c7d3a057f890932/images/5dcbf91b04286364bc91b15f/file-OgBeCdv8o6.gif)
Let btnBlue = document.querySelector('#btnBlue') let btnRed = document.querySelector('#btnRed') Upon click of the green button, we will change the text color to green.Upon click of the blue button, we will change the text color to blue.Upon click of the red button, we will change the text color to red.We will use this property to change the color of the text inside the paragraph element. This property points to an object which contains all style-related properties. The paragraph element has style property.We have attached a click event listener to all the button elements.We have selected all 3 button elements and the paragraph element using the document.querySelector() method and stored them in btnRed, btnBlue, btnGreen, and content variables respectively.Tenetur beatae vel, impedit consequuntur harum animi quisquam enim ducimus aliquam expedita accusantium obcaecati fugit unde pariatur saepe alias dolore inventore non. Lorem, ipsum dolor sit amet consectetur adipisicing elit. We have also included our javascript file script.js with a script tag at the bottom.We have done some basic styling using CSS and added the link to our style.css stylesheet inside the head element.We will change its color on the button click. The paragraph element contains some random text content.The 3 button elements have “Red”, “Blue”, and “Green” as their inner text.The div element with a class of container is just a wrapper for the rest of the elements. We have 6 elements in the HTML file (2 div, 3 button, and 1 p).