Is there any way to create prompt in JavaScript with two input fields ?
I tried that code, but it didn't help me :
var a = prompt("A : ", ""); var b = prompt("B : ", ""); alert(a + "\n" + b);
The prompt() method displays a dialog box that prompts the user for input. The prompt() method returns the input value if the user clicks "OK", otherwise it returns null .
Description. x = input( prompt ) displays the text in prompt and waits for the user to input a value and press the Return key. The user can enter expressions, like pi/4 or rand(3) , and can use variables in the workspace. If the user presses the Return key without entering anything, then input returns an empty matrix.
This is not possible with an OS or native browser window popping up. You will have to create a custom overlay dialog.
I would advise using a library like jQuery UI to do this. You can then customize whatever is in the popup.
You can view a demo of the dialog here
Short of constructing your own using DOM methods and Input elements: No.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With