Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javascript input via native popup

Tags:

javascript

In the past, I've seen javascript alert() style popups but they had input fields in them.

These forms are much like the primitive username/password field inputs you see when an .htpasswd file is used.

Can someone tell me how to implement this using regular javascript? (No libraries please)

like image 693
maček Avatar asked Oct 13 '10 20:10

maček


People also ask

How to display a popup message in JavaScript?

One useful function that's native to JavaScript is the alert() function. This function will display text in a dialog box that pops up on the screen. Before this function can work, we must first call the showAlert() function. JavaScript functions are called in response to events.

How to use prompt box in JavaScript?

A prompt box is often used if you want the user to input a value before entering a page. When a prompt box pops up, the user will have to click either "OK" or "Cancel" to proceed after entering an input value. If the user clicks "OK" the box returns the input value. If the user clicks "Cancel" the box returns null.

What is popup box in JavaScript?

In Javascript, popup boxes are used to display the message or notification to the user. There are three types of pop-up boxes in JavaScript namely Alert Box, Confirm Box and Prompt Box.

What are the types of pop up boxes available in JavaScript?

In JavaScript, Alert Box, Prompt Box, and Confirm Box are the three types of the popup boxes.


1 Answers

Yes, you're thinking of prompt. It's just:

var userInput = prompt("text to display", "default input text");

Note that this is just a general input mechanism. It's separate from the authentication dialog, though the underlying browser code may use the same GUI controls.

like image 173
Matthew Flaschen Avatar answered Sep 23 '22 08:09

Matthew Flaschen