window.prompt()
Returns: string - message entered by the user in the prompt field or default value if nothing entered.
Since: v7.0.0
<br></br>
Displays a Prompt message dialog putting the application in a modal state while <b>not blocking</b> the Javascript thread and still allowing processing of events in the main event loop.
data-variant=info
data-slots=text
UXP behaviour is different from the standard behaviour of blocking the javascript thread of execution until the dialog has been dismissed.
The following are additional simple alerts supported by UXP
Param
Type
Description
message
stringA string of text to display to the user.
prompt
stringDefault value for the field.
Example
// Below prompt function has 2 params
// "Enter your name: " - Message to display
// "Adobe" - Default value that will be present in the Prompt pop-up at launch
prompt("Enter your name: ","Adobe");
<b> Note: </b>
- Since UXP v7.4,
prompt()can only be invoked inpluginvia the featureFlagsenableAlerts. Update your Manifest v5 with the following
"featureFlags": {
"enableAlerts": true
}
- Since UXP v7.4,
prompt()is disabled forscripts