How can I use the input from user after he/she enters information via JavaScript prompt?. Especially to use it on the same page | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can I use the input from user after he/she enters information via JavaScript prompt?. Especially to use it on the same page

Incorporation of user input in web development

14th Feb 2019, 12:35 PM
Bukachi Nixon
Bukachi Nixon - avatar
5 Answers
+ 1
Use this snippet if(!isNaN(parseInt(input))&&isFinite(input)) { setTimeout(()=>{ //TODO: Animation },1000) //will perform the provided animation after 1s }
14th Feb 2019, 1:26 PM
Seniru
Seniru - avatar
+ 2
You can just store the value returned (the user input) by the prompt in a variable. var input = prompt("enter something"); console.log(input) // logs the user input
14th Feb 2019, 12:41 PM
Seniru
Seniru - avatar
+ 1
Please Seniru Pasan , if I want to ensure only numerics are entered. And then to use the number as number of seconds to display an animation, what's the best way to do this?
14th Feb 2019, 1:15 PM
Bukachi Nixon
Bukachi Nixon - avatar
0
Thank you Seniru Pasan
14th Feb 2019, 12:50 PM
Bukachi Nixon
Bukachi Nixon - avatar
0
Thanks again.
14th Feb 2019, 1:37 PM
Bukachi Nixon
Bukachi Nixon - avatar