Tell us what’s happening:
im not sure whats wrong but i should be able to pass instruction five and i can get it to pass.
Your code so far
<!-- file: index.html -->
<input id= "text-input"></input>
<button id= "check-btn"></button>
<p id ="result"></p>
/* file: script.js */
const checkButton = document.getElementById("check-btn");
const textInput = document.getElementById("textInput");
const result = document.getElementBYId("result");
checkButton.addEventListener("click", ()=> {if(input.value ===){alert("please input a value")}
})
/* file: styles.css */
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36
Challenge Information:
Build a Palindrome Checker Project - Build a Palindrome Checker
ryanstruckus:
if(input.value ===)
what does this condition do?
its supposed to tell the programe if the input value is nothing trigger the alert
You are missing something?
what am i missing a simi colon?
ILM
October 9, 2024, 9:19am
6
the second element of the comparison, there must be something to the right of the comparison operator, otherwise it’s a syntax error
ok i fixed that now i am trying to focus on instruction 4. 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"
. as far as i can tell it should work but i cant get the code to pass
const textInput = document.getElementById("textInput");
const result = document.getElementBYId("result");
checkButton.addEventListener("click", ()=> {if(input.value === ""){alert("please input a value")}
})
getElementById("textInput")
the value is not correct. You need to add id
attribute value. Also the result
assignment have wrong syntax in getElementById
.
input.value
is undefined
.
so then what would be the value
text input is the element i want so isnt text input the value
and is result suppsoed to be undefined the instrution says if the value is empty triger the alert
const textInput = document.getElementById("textInput");
const result = document.getElementBYId("result");
checkButton.addEventListener("click", ()=> {if(input.value === ""){alert("please input a value")}
})
In above code you defined textInput
variable you need to use that variable within the if condition.
Post your updated. You can’t change const
to if
const checkButton = document.getElementById("check-btn");
const textInput = document.getElementById("textInput");
const result = document.getElementBYId("result");
checkButton.addEventListener("click", ()=> {if(text-input.value === ""){alert("please input a value")}
})
ryanstruckus:
("textInput");
TextInput is not the input`s id value. Use correct input elements id value
ryanstruckus:
getElementBYId
Latter casing is not correct.
ryanstruckus:
if(text-input.value
Use the variable textInput
here.
i think i made all the corections but still doesnt pass
const checkButton = document.getElementById("check-btn");
const text-Input = document.getElementById("text-Input");
const result = document.getElementById("result");
checkButton.addEventListener("click", ()=> {if(textinput.value === ""){alert("please input a value")}
})
ryanstruckus:
{
const text-Input = document.getElementById("text-Input");
is capital I correct in your brackets? Have a look at user story 1.
Your variable name uses a dash which can’t be done - remove the dash.
In your code you refer to “textinput” but you have no variable with that exact name.
Look at user story 4 - is your warning text exactly as asked?
ILM
October 12, 2024, 1:16pm
19
ryanstruckus:
if(textinput.value
do you have a variable textinput
? or did you call it something else?
im seein alot of questions wither i have a textiput vairable its the seacond const in the code
const checkButton = document.getElementById("checkbtn");
const textInput = document.getElementById("textInput");
const result = document.getElementBYId("result");
checkButton.addEventListener("click", ()=> {if(input.value === ""){alert("please input a value")}
})