javascript change button style code example
Example 1: javascript change color of button
document.getElementById("button").style.background='#000000';
Example 2: javascript change button text onclick
<!DOCTYPE html>
<html>
<body>
<button id="demo" onclick="myFunction()">Click me to change my HTML content (innerHTML).</button>
<script>
function myFunction() {
document.getElementById("demo").innerHTML = "Paragraph changed!";
}
</script>
</body>
</html>