`
// VARIABLES
let guessInput = document.getElementById("guess-input").value;
let guessValue = document.getElementById("guess-btn");
// RANDOM
let randomValue = Math.floor(Math.random() * 11);
console.log(randomValue);
// GUESSES
let guesses = 3;
// ADD EVENT LISTENER
guessValue.addEventListener("click", main());
function main() {
while (guesses != 0 || guessInput == randomValue) {
if (guessInput == randomValue) {
} else {
document.getElementById("guess-input").style.border = "solid 5px red";
}
}
}
When I add javascript file to my HTML file it won’t load it will just keep loading and nothing will happen. I tried everything I know but nothing works. Websites form internet works perfectly. I can inlcude javascript file, but the thing is that no matter what I try to load from my previous works nothing loads with javascript linked. The problem is I can’t load any javascript from my computer
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.css"
/>
<title>Number Guesser</title>
</head>
<body>
<div class="container">
<h1>Number Guesser</h1>
<div id="game">
<p>
Guess a number between <span class="min-num">0</span> and
<span class="max-num">10</span>
</p>
<input
type="number"
id="guess-input"
placeholder="Enter your guess..."
/>
<input type="submit" value="Submit" id="guess-btn" />
<p class="message"></p>
</div>
</div>
<script type="text/javascript" src="script.js"></script>
</body>
</html>