Is there any way to create prompt with two input fields?

TN888 picture TN888 · Aug 1, 2013 · Viewed 90.8k times · Source

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);

Answer

NDM picture NDM · Aug 1, 2013

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