W3 per-generated file that I made a few changes to based off things I thought I understood. Why doesn’t the button work when it runs?
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h2>Demo JavaScript in Head</h2>
<p id="demo">A Paragraph.</p>
<button id="button">Try it</button>
<script>
document.getElementById("button").onclick = myFunction() {
document.getElementById("demo").innerHTML = "paragraph changed.";
}
</script>
</body>
</html>