[Solved] The JavaScript cannot be opened if I click the button [closed]


it’s sample on w3schools

You can try it.

    <!DOCTYPE html>
<html>
<body>

<p>This example uses the HTML DOM to assign an "onclick" event to a p element.</p>

<p id="demo">Click me.</p>

<script>
document.getElementById("demo").onclick = myFunction();

function myFunction() {
  //your codes here Zean
  document.getElementById("demo").innerHTML = "YOU CLICKED ME!";
}
</script>

</body>
</html>

solved The JavaScript cannot be opened if I click the button [closed]