Build a Palindrome Checker Project - Build a Palindrome Checker

Tell us what’s happening:
I can’t solve this step , and also I’m having trouble approaching the steps in the project overall…
image

Your code so far

<!-- file: index.html -->
<!DOCTYPE html>
  <html lang='en'
  <head>
  <meta charset='UTF-8'>
     <link href="styles.css" rel="stylesheet"/>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
   </head>
<body>
<title>Palindrome Checker MH</title>
<input id="text-input" type="text"/>
<button id="check-btn"></button>
<div id="result"></div>
<script src="./script.js"></script>
</body>
</html>


/* file: styles.css */

/* file: script.js */
const textInput = document.querySelector('#text-input')
const checkBtn = document.querySelector('#check-btn')


checkBtn.addEventListener('click',noValue);
textInput.addEventListener(onlyA)

function noValue(){ if(textInput.innerContext === null, alert('Please input a value')){
    
  }
}

function onlyA() {
  if(cleanInput === A) {
  result.innerHTML = "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/122.0.0.0 Safari/537.36

Challenge Information:

Build a Palindrome Checker Project - Build a Palindrome Checker

Welcome to the forum @mnkenchor4206

  1. Here is the console error:

Uncaught TypeError: Failed to execute ‘addEventListener’ on ‘EventTarget’: 2 arguments required, but only 1 present.

  1. What have to done to debug?

  2. Here is a pointer on how to structure the addEventListener method.

  3. The onlyA function may not be the correct approach.
    What if any other single letter is submitted?

  4. In the html file you need to close the html opening tag.

  1. Consider nesting appropriate text in the button element.
  1. It may help to write down in your own words what the checker is supposed to do. That way you have a starting point to formulate the logic required.

The first project is usually the toughest. But you will learn so much.

Happy coding

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.