please where did i go wrong
<!-- 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>Palindrome Checker</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<main class="container">
<h1>Palindrome Checker</h1>
<label for="text-input">Enter in text to check for a palindrome:</label>
<input id="text-input" required>
<button id="check-btn">check</button>
<div id="result"></div>
</main>
<script src="script.js"></script>
</body>
/* file: styles.css */
*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'poppins', sans-serif;
}
body{
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background: skyblue;
}
.container{
background: #eee;
max-width: 500px;
}
/* file: script.js */
const textInput = document.getElementById("text-input");
const checkBtn = document.getElementById("check-btn");
const result = document.getElementById("result");
let input ="";
let textValue = "";
let originalText = "";
let reversedText = "";
checkBtn.addEventListener('click', () => {
if (input === "") {
alert("Please input a value")
}
})
textInput.addEventListener('change', (event) => {
input = (event.target.value);
textValue = input.toLowerCase().replace(/[^a-z0-9]/g, "");
})
originalText = text.value;
reversedText = originalText.split("").reverse().join("");
palindrome = (input) => {
if (input === reversedText) {
result.textContent = `${textInput} is a palindrome`;
return true;
} else {
result.textContent = `${textInput} is not a palindrome`;
return false;
}
}
console.log(palindrome("eye"));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Challenge Information:
Build a Palindrome Checker Project - Build a Palindrome Checker