prompt

The prompt JS Prompts displays a modal text control prompt with the given message, waits for the user to dismiss it, and returns the value that the user entered. If the user cancels the prompt, then returns null instead. If the second argument is present, then the given value is used as a default.

Syntax

result = window.prompt(message[, default])

Parameters

message

A string to display in the prompt.

default

A string to return as the default result.

Examples

1 · void

2 · message

3 · default

alert

confirm

Web Hypertext Application Technology Working Group (WHATWG)

Home Menu