How To Change Text Color On Click Using JavaScript?

Golang Programs Golang React JS Technology Blog

Golang Tutorial

Introduction Variables Constants Data Type Convert Types Operators If..Else Switch..Case For Loops Functions Variadic Functions Deferred Functions Calls Panic and Recover Arrays Slices Maps Struct Interface Goroutines Channels Concurrency Problems Logs Files and Directories Reading and Writing Files Regular Expression Find DNS records Cryptography Gotchas in Golang Import and Export Best Golang Packages Web Application Goroutines and Channels Exercises Reflection in Golang Golang for beginners Strings in Golang HTTP Client Server Examples Context Package

Golang Reference

Basic Programs Advance Programs Data Structure and Algorithms Date and Time Slice Sort, Reverse, Search Functions String Functions Methods and Objects Interface Type

Beego Framework

Beego Setup Beego Database Migration Beego GET POST Beego Routing How to change text color on click using JavaScript?

Example

Change Color

Learn the test-driven development approach when building apps

<!DOCTYPE html> <html> <head> <title>Change Color</title> </head> <body> <button id="changeGreen">Change Font Color Green</button> <button id="changeRed">Change Font Color Red</button> <p> <span id="output">Learn the test-driven development approach when building apps</span> </p> <script> document.getElementById("changeGreen").onclick = function(){ document.getElementById("output").style.color = 'green'; } document.getElementById("changeRed").onclick = function(){ document.getElementById("output").style.color = 'red'; } </script> </body> </html>
Most Helpful This Week
ES6 method of declaration multiple variables in one line JavaScript example to change image on click jQuery example of scroll to top Highlight and get the details of table row on click using JavaScript jQuery simple form validations between start date and end date How to change the height of Textarea on click?
Most Helpful This Week
Replace numbers by zero from stringHow to declare and access pointer variable?How to get struct variable information using reflect package?How to delete or remove element from a Map?How to check UPPERCASE characters in a string in Golang?How pointer & and * and ** works in Golang?Copy an array by value and reference into another arrayHow to use a mutex to define critical sections of code and fix race conditions?How to trim leading and trailing white spaces of a string in Golang?Find capacity of Channel, Pointer and Slice Golang Programs is designed to help beginner programmers who want to learn web development technologies, or start a career in website development. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. Copyright 2016-23. All Rights Reserved. Contact Us

Từ khóa » Html Color Text Javascript