I merged your threads. Please do not create new threads for the same question. Thank you.
Read the post above your latest post.
I merged your threads. Please do not create new threads for the same question. Thank you.
Read the post above your latest post.
Hey Lasjorg,
my sincere apology! Thanks for the update as well!
Add a click handler to the button. You can call the palindrome
function using onclick="palindrome()"
on the button.
Inside the palindrome
function, instead of using the str
parameter, get the text from the value
property of the textInput
element and use that.
Instead of returning true
and false
update the result
elements text content with the required text.
Validate your code works with all the test cases.
Handle an empty input as required.
Thanks Teller, Just clarified the typo! Still at work with my test!
Keep up the progress. The first one is the most challenging. The one I did took nearly two weeks. If you find yourself not making any progress, take a one or two day break. It can also help to write down in words what you want the code to do. Identify knowledge gaps, then just Google if a method or way of coding exists.
Happy coding
I definitely believe you Teller, but I will keep trying everyday for an hour or two. I don’t mind how much difficulty I am experiencing for now but, I will figure out what I am actually missing!
I have started my life many times over and over again in new directions! All the time I arrived at a New Beginning Point, it was always difficult like the test I am having tough time with now but, I never allowed my obstacle to be my setback .
@lasjorg @JeremyLT @jwilkins.oboe
I am grateful to have you guy here as guidance and supporters. Billions of people in the next years to come will be a professional coder because of you guys! I thank you guys for the motivation and courage. Means a lot.
will come back tomorrow again and research and try another method!
Hi Easside, I think you are really close! But I think you should review how we pull up html elements by id:
Also, check your last line regarding what happens when you press the button.
Just remember querySelector
takes a CSS selector, it only knows what element it is looking for by the selector specifying it.
Unlike say getElementById
which only can look for ids (so #
is not needed).
Which tests are failing?
()
the isPalindrome
callback function. You should pass it just the identifier isPalindrome
so that when the event triggers it calls the callback function.buttonCheck.addEventListener("click", isPalindrome());
const textInput = document.querySelector("#text-input");
const checkBtn = document.querySelector("#check-btn");
const result = document.querySelector("#result");
textInput
not inputText
checkBtn
not buttonCheck
string
is not the correct name, it is capital S String()
. You can technically do what you are doing, stringifying arrays and comparing them but I’m not sure I would suggest doing that. But it does work in this case so up to you.Hi @hiekamara1
Just had a quick glance at your code.
Add a single space before the word is
in the string.
Happy coding
How does the function button alert get called?
By adding it to the Event Listener!
Thanks guys! I just pass one of the test. While is true, I have the remaining test to pass and complete the challenge, I am really grateful for all of the helps! means much to me!
I don’t think these functions should exist. You’re trying to hardcore the answer, which is a no-no
Hey JeremyLT,
Thanks for your quick reply! I don’t understanding what do mean by hardcore the answer? Can you please elaborate in a bit detail on my codes!
There are different texts given in the Test to check if they are Palindrome or not a Palindrome. That is why I created different functions to enter the respective text as given in the instruction.
if these functions should not exist, can you please give me a clearer hint! I felt all the Texts to be check needed a specific function
The functions definitely should not exist. The hint is to delete them. Your buttonAlert
and isPalindrome
code should handle all those cases without separate functions.
One more question please! Can I use statement like in the buttonAlert to enter the rest of the text to be check and call isPalindrome ?
This logic seems good to me