Script doesn't work outside the html
Edu Henrique
<!DOCTYPE html>
<html>
<head>
<title>Button Game</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
.button {
border: none;
color: white;
padding: 30px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 1000px;
margin: 4px 2px;
cursor: pointer;
}
</style>
<script src="script.js"></script>
</head>
<body style="background-color:rgba(0, 119, 255, 1)">
<h2 style="text-align:center; font-family:trebuchet ms;">Click the buttons when they appear!</h2>
<p id="demo" style="text-align:center">Testing...</p>
<button type="button" onclick="g()" class="button"></button>
</body>
</html>
After all of this (index.html)
function g() {
document.getElementById("demo").innerHTML = "Test complete!";
}
And this (script.js)
The button doesn't update the paragraph, yet there's nothing wrong with the files. No typos, no incorrect directories, no inconsistent text, nothing. And it still doesn't update. At least not on your website