Your HTML markup is not standard correct. Any contents should be warped inside the body tag. However, your code does not need button.onclick = myFunction;
the function is already called with the onclick
button event attribute.
The incorrect markup may work like:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script>
function myFunction() {
//button.onclick = myFunction;
document.getElementById("mot").style.visibility = "visible";
}
</script>
</head>
<button onclick="myFunction()" style="visibility:visible;">Motivation</button>
<body id="mot" style="visibility:hidden;">
<p>It's harder too read code, then it is too write code</p>
<p>Practice makes better, not perfect</p>
<p>Good things take time, the better, the longer</p>
</body>
</html>
This is a DEMO
To fix markup as Lee suggested above, place the motivational comments inside a div.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script>
function myFunction() {
//button.onclick = myFunction;
document.getElementById("mot").style.visibility = "visible";
}
</script>
</head>
<body>
<button onclick="myFunction()" style="visibility:visible;">Motivation</button>
<div id="mot" style="visibility:hidden;">
<p>It's harder too read code, then it is too write code</p>
<p>Practice makes better, not perfect</p>
<p>Good things take time, the better, the longer</p>
</div>
</body>
</html>