+ 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
4 Antworten
+ 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.
+ 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
+ 3
thanks it's working
0
What do you mean exactly, I have a hard time understanding.