How will I use javascript to accept a prompt value and check if it is a name in a variable and display the html | Sololearn: Learn to code for FREE!
+ 2

How will I use javascript to accept a prompt value and check if it is a name in a variable and display the html

Javascript

9th Jan 2019, 6:39 PM
Prince Asiedu
Prince Asiedu - avatar
4 Answers
+ 4
If I understand it correctly, you want to check user input if it matches the name you saved in a variable. And continue to ask for input as long as it doesn't match. And you want to load the page only after it matches. Use a do while loop to do the input validation and you need to put the prompt script at the head tag. https://code.sololearn.com/W6WxWB0nh1BH/?ref=app Take note that this works on Code Playground and I'm not sure if this would also work in a web browser.
9th Jan 2019, 10:45 PM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar
+ 3
I mean, using Javascript to check if the value a user will input in a prompt is correct before the Web page will display
9th Jan 2019, 9:08 PM
Prince Asiedu
Prince Asiedu - avatar
+ 3
thanks it's working
9th Jan 2019, 11:14 PM
Prince Asiedu
Prince Asiedu - avatar
0
What do you mean exactly, I have a hard time understanding.
9th Jan 2019, 8:29 PM
Korijn Jagersma
Korijn Jagersma - avatar