js btn color change by click code example
Example 1: javascript change color of button
document.getElementById("button").style.background='#000000';
Example 2: onclick change text color javascript
<script>
document.getElementById('change').onclick = changeColor;
function changeColor() {
document.body.style.color = "purple";
return false;
}
</script>