text color change in js code example
Example 1: onclick change text color javascript
<script>
document.getElementById('change').onclick = changeColor;
function changeColor() {
document.body.style.color = "purple";
return false;
}
</script>
Example 2: js element text color
element.style.color = '#f0f';