Build a Palindrome Checker Project - Build a Palindrome Checker

Tell us what’s happening:

Please tell me the problem i am having in the code. Stuck from past 2 days.

Your code so far

<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
    <title>Palindrome Checker</title>
    <meta charset="UTF-8">
    <meta name="content" width="device-width initial-scale=1.0">
    <rel link="stylesheet" href="styles.css">
    <h1>Palindrome Checker</h1>
      <h3>Is it a Palindrome?</h3>

       <div id="result">
         <!-- <fieldset>
           Enter a number or text to check if it is a palindrome or not: <br> -->
     <input type="text" id="text-input">
     <button id="check-btn">Check</button>
          <!-- </fieldset> -->
<script src="script.js"></script>
/* file: styles.css */

/* file: script.js */
document.addEventListener("DOMContentLoaded", () => {
const checkButton = document.getElementById("check-btn");
const text = document.getElementById("text-input");
const result = document.getElementById("result");

checkButton.addEventListener("click", () => {
  const lowerReplaced = text.value.replace(/[^A-Za-z0-9]/g, "");

  if (text.value === "") {
    window.alert("Please input a value");
  } else if (text.value.length === 1) {
    result.innerText = `${text.value} is a palindrome`;
  } else if (lowerReplaced === lowerReplaced.split("").reverse().join("")) {
    result.innerText = `${text.value} is a palindrome`;
  } else {
    result.innerText = `${text.value} is not a palindrome`;

Your browser information:

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

Challenge Information:

Build a Palindrome Checker Project - Build a Palindrome Checker

“A palindrome is a word or phrase that can be read the same way forwards and backwards, ignoring punctuation, case, and spacing.”

Make sure you are taking all of the requirements into account.

Welcome to the forum @OmPorje

Which of the user stories is your coding failing?

Happy coding