Tell us what’s happening:
Hello friends, I am finding myself stuck on part #4: " When you click on the #check-btn
element without entering a value into the #text-input
element, an alert should appear with the text Please input a value
". I feel as if I am misunderstanding something or that I have made some type of idiotic typo that I haven’t discovered. When I click the “Check” box nothing happens. I have checked online and attempted multiple changes and nothing seems to work. Any help or review of my code is greatly appreciated. Thanks!
Your code so far
<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<input id="text-input">
<button id="check-btn">Check</button>
<div id="result"></div>
<script src="script.js"></script>
</body>
</html>
/* file: script.js */
const textInput = document.GetElementById("text-input");
const checkButton = document.GetElementById("check-btn");
const result = document.GetElementById("result");
checkButton.addEventListener("click", () => {
if (textInput.value === "") {
alert("Please input a value")
}
});
/* file: styles.css */
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:136.0) Gecko/20100101 Firefox/136.0
Challenge Information:
Build a Palindrome Checker Project - Build a Palindrome Checker