<html>
<body>
<p id="demo" onclick="myFunction()">Click me to change my text color.</p>
<p>A function is triggered when the p element is clicked. The function sets the color of the p element to red.</p>
<script>
function myFunction() {
document.getElementById("demo").style.color = "red";
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/tags/tryit.asp?filename=tryhtml5_ev_onclick2 by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 03:09:26 GMT -->
</html>