prompt() and confirm() for browser users
In addition to the well known alert()
, prompt()
and confirm()
also allow to interact with browser users.
prompt(message, defaultValue)
- Show a dialog to prompt the user for an information. Provide an optional default value. Return value is the string entered by the user or null. MDN window.prompt().
confirm(message)
- Show a dialog to provide an information to the user and wait until the user confirms or cancels. Return value is a boolean indicating if the user confirmed (true), or canceled (false). MDN window.confirm().
alert(message)
- Display a dialog with an optional message and wait until the user dismisses the dialog. MDN window.alert()
See the CodePen prompt(), confirm(), and alert().
Comments