Build a Palindrome Checker - Build a Palindrome Checker

Tell us what’s happening:

The test tells me I,m not using .addEventListener() for showing a message

Your code so far

<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <title>Palindrome Checker</title>
</head>

<body>
    <h1>Is it a Palindrome?</h1>
    <input id="text-input" type="text" placeholder="Escribe algo aquí...">
    <button id="check-btn"></button>
    <div id="result"></div>
</body>

</html>

/* file: styles.css */

/* file: script.js */
const textInput = document.querySelector("#text-input");
const checkBtn = document.querySelector("#check-btn");
const result = document.querySelector("#result");

checkBtn.addEventListener("click", () => {
  if (textInput.value.trim() === "") {
    alert('Please input a value');
  }
});

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/150.0.0.0 Safari/537.36 Edg/150.0.0.0

Challenge Information:

Build a Palindrome Checker - Build a Palindrome Checker

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/lab-palindrome-checker/657bdc55a322aae1eac3838f.md at main · freeCodeCamp/freeCodeCamp · GitHub

Hey @jesusfortune,

Hint message:

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.

Try clicking #check-btn without entering a value. Is there any alert popping?

You need to make sure if check-btn is clicked without entering a value, an alert should pop up. Once you do that, you’ll be able to pass this particular test.

Happy coding~

there is not alert popping when I click the button

How can you test if your function is running when the button is clicked?