The easy way: use prompt and show it twice. If you want two inputs in one popup, this can't be done.
var fname = prompt("what's your first name?");
var lname = prompt("what's your last name?");
The correct way: hide the document behind a transparent div, then render the modal dialog on top of it. Add a click handler to a button inside the dialog.
<body>
..
<div id="popup">
<div id="popup-content">
</div>
</div>
</body>
...
var $popup = $("#popup")
var $popupContent = $("#popup-content")
...
if($popup.is(":visible")) throw "Can't handle two popups at once";
$fname = $("<input>");
$lname = $("<input>");
$submit = $("<input>", {type: "button"}).on("click", popupDone);
$popupContent.empty().append(
$("<p>").append("first name:", $fname),
$("<p>").append("last name:", $lname),
$submit
)
function popupDone(){
//handle the data:
console.log("your name is " + $fname.val() + " " + $lname.val())
}
...
#popup{
position: fixed;
top: 0; left: 0;
background: rgba(0, 0, 0, 0.5) /* some nice overlay */
}
#popup-content{
position: absolute;
top: 0; left: 0;
bottom: 0; right: 0;
padding: 10px;
margin: 10px; /* some nice positioning */
}
prompt, you'll have to show it twice