can someone tell me why the below code wont work and provide a possible fix. When the button is hit I want it to display either correct or incorrect based on whether the user entered a number into the input field.
HTML:
<!DOCTYPE html>
<body>
<p>Enter name:</p>
<input type="text" name="name"></input>
<button onclick="checkpeople()" type = "button">check</button><br>
<p id="message"></p>
<script src="script.js"></script>
</body>
JS:
function checkpeople() {
var name = "";
if (isNaN(name)) {
name = "incorrect"
}
else {
name = "correct"
}
document.getElementById('message').innerHTML = name;
}