Tell us what’s happening:
Describe your issue in detail here.
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">
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1>Palindrome Checker</h1>
<input id="text-input" placeholder="Enter your word/sentence">
<button id="check-btn">Check</button>
<div id="result">Result:</div>
</body>
</html>
/* file: styles.css */
h1 {
padding: 20px;
margin: auto 100px;
display: flex;
justify-content: center
}
#text-input {
display: flex;
justify-content: center;
align-items: center;
position: absolute;
left: 200px
}
/* file: script.js */
const palindromeInput= document.getElementById("text-input")
const checkBtn = document.getElementById("check-btn")
const result= document.getElementById("result")
function isPalindrome(str) {
const input = palindromeInput.value
const cleanedStr = input.replace(/[^a-zA-Z0-9]/g, '').toLowerCase();
const reversedStr = cleanedStr.split('').reverse().join('')
if(cleanedStr === reversedStr) {
result.innerHTML = input + "this is a Palindrome"
} else {
result.innerHTML = input + "this is not a Palindrome"
}
}
``
can somoen tell me what im doing wrong ?