Build a Palindrome Checker Project - Build a Palindrome Checker

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

You appear to have created this post without editing the template. Please edit your post to Tell us what’s happening in your own words.

1 Like

Thank you for your reply! Perhaps I am not understanding, however I believe I’ve said what I am having difficulty with. If I am doing something wrong with asking this question please do let me know. Thank you!

Hi @ErcDz

The system generated message sometimes messes up.

Your button functionality is not working because there is no link in the html file. The css file is also not linked.

Happy coding