Edit This Code:
<!DOCTYPE html>
<html>
<body>

<p>This example uses the addEventListener() method to execute a function when a user clicks anywhere in the document.</p>

<p id="demo">

<script>
document.addEventListener("click", myFunction);

function myFunction() {
    document.getElementById("demo").innerHTML = "Hello World";
}
</script>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy