Tell us what’s happening:
Describe your issue in detail here.
When the #text-input
element only contains the letter A
and the #check-btn
element is clicked, the #result
element should contain the text A is a palindrome
.
i am getting problem in this step
<!-- file: index.html -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Palindrome Checker</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Palindrome Checker</h1>
<label for="text-input">Enter a word or phrase:</label>
<input type="text" id="text-input" required>
<button type="submit" id="check-btn" onclick="myFunction()">Check</button>
<div id="result"></div>
<script src="script.js"></script>
<script src="https://replit.com/public/js/replit-badge-v2.js" theme="dark" position="bottom-right"></script>
</body>
</html>
/* file: styles.css */
/* file: script.js */
function myFunction(){
let textinput = document.getElementById('text-input').value;
const checkbtn = document.getElementById('check-btn').innerHTML;
let result = document.getElementById('result');
if(textinput == ""){
alert("Please input a value");
}
else if(textinput == "A" && document.getElementById('check-btn').clicked == true){
console.log("A is a palindrome");
}
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36
Challenge Information:
Build a Palindrome Checker Project - Build a Palindrome Checker