Change Style with JavaScript

Example modifying CSS using JavaScript.

Preview

Code

<p id="colorText">Click the button to change color.</p>

<button onclick="document.getElementById('colorText').style.color='red';">
Change Color
</button>

More HTML JavaScript Examples (7)