<!DOCTYPE html>
<html>
<body>

<p>This example uses the addEventListener() method to attach a click event to the document.</p>

<p>Click anywhere in the document.</p>

<p><strong>Note:</strong> The addEventListener() method is not supported in Internet Explorer 8 and earlier versions.</p>

<p id="demo"></p>

<script>
document.addEventListener("click", function(){
    document.getElementById("demo").innerHTML = "Hello World!";
});
</script>

</body>
</html>