About User Prompts

suggest change

User prompts are part of the Web Application API. They open browser modals that ask the user to confirm or enter something.

window.alert(message)

Show a modal popup with a message to the user.

Requires the user to click [OK] to dismiss.

alert("Hello World");

More information is in Usage of alert.

boolean = window.confirm(message)

Show a modal popup with the provided message.

Provides [OK] and [Cancel] buttons which will respond with a boolean value true / false respectively.

confirm("Delete this comment?");

result = window.prompt(message, defaultValue)

Show a modal popup with the provided message and an input field with an optional pre-filled value.

Returns the text the user entered, or null if the user dismisses the dialog. An optional defaultValue pre-fills the field.

prompt("Enter your website address", "http://");

More information is in Usage of prompt.

window.print()

Opens a modal with document print options.

print();

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents