Tell us what’s happening:
Describe your issue in detail here.
I don’t have the palindrome checker functionality yet, but for some reason when the input is empty nothing is happening. Can someone explain why this is?
<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Hello, world!</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="" />
<link rel="icon" href="favicon.png">
</head>
<body>
<h1>Hello, world!</h1>
<input id="text-input"/>
<button id="check-btn" type="button">Check</button>
<div id="result"></div>
</body>
</html>
/* file: styles.css */
.button {
padding: 50px;
}
h1 {
background-color: black;
}
/* file: script.js */
const mainBtn = document.getElementById("check-btn")
mainBtn.addEventListener('click', () => {
var inputValue = document.getElementById('text-input').value;
if (inputValue === "") {
alert("Please input a value.");
} else if (inputValue === "hello") {
}
});
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36
Challenge Information:
Build a Palindrome Checker Project - Build a Palindrome Checker