<p onclick="myfunction(this,red)"> click me to change my text color code example
Example: onclick change text color javascript
<script>
document.getElementById('change').onclick = changeColor;
function changeColor() {
document.body.style.color = "purple";
return false;
}
</script>