Change Text Color of HTML Elements

JavaScript Change text color functionality can be created by using JavaScript DOM style properties. In this sample color property of style object of JavaScript DOM has been used to change the font color of the HTML element.

JavaScript Dom Features Used

1. document object

2. getElementsById method

3. style object

4. color property

Try the sample below to learn and practice the JavaScript DOM code for developing this functionality:

Edit this code and click update to view output
OUTPUT: