Error code:
When you click on the #check-btn element without entering a value into the #text-input element, an alert should appear with the text Please input a value
My code so far:
const palInputCheck = input => {
const inputOriginal = input;
if (inputOriginal === “”) {
alert(“Please input a value”);
return;
}
I’m still getting this error, I have my js script linked in HTML. Am I using the alert wrong?
Thanks!
I’m not sure since you haven’t shared the rest of your code, but I also fed the alert text into the result of the page.
const palInputCheck = () => {
const inputOriginal = input;
if (inputOriginal === “”) {
alert(“Please input a value”);
return;
}
const lower = input.replace(/[^A-Za-z0-9]/gi, “”).toLowerCase();
let resultPal = “${inputOriginal}”
{lower === […lower].reverse().join(“”) ? “is” : “is not”}
" a palindrome.";
check.addEventListener(“click”, palInputCheck);
result.div.remove(“hidden”);
};
It’s supposed to pull up a window, right?
Imma rewrite it without the arrow function, see if that does anything.
I don’t see that you have defined the variable “input”.
system
Closed
July 30, 2024, 7:20am
6
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.