Tell us what’s happening:
my code Is perfectly fine and logic is correct too I got the out put In console but still it’s showing an error
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">
<title>Document</title>
</head>
<body>
<input id="text-input"></input>
<button id="check-btn" ></button>
<div id="result"></div>
</body>
<script src="script.js"></script>
</html>
/* file: script.js */
const textInput=document.getElementById("text-input");
const checkButton=document.getElementById("check-btn");
const result=document.getElementById("result")
checkButton.addEventListener("click",()=>{
if(textInput.value===""){
alert("Please input a value");
}
else if(textInput.value.length===1){
result.innerText=`${textInput.value} is a plaindrome`
}
});
/* file: styles.css */
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.3 Safari/605.1.15
Challenge Information:
Build a Palindrome Checker Project - Build a Palindrome Checker