---
title: "webView(_:runJavaScriptTextInputPanelWithPrompt:defaultText:initiatedBy:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/webuidelegate/webview(_:runjavascripttextinputpanelwithprompt:defaulttext:initiatedby:)"
---

# webView(_:runJavaScriptTextInputPanelWithPrompt:defaultText:initiatedBy:)

Displays a JavaScript text input panel and returns the entered text.

## Declaration

```swift
optional func webView(_ sender: WebView!, runJavaScriptTextInputPanelWithPrompt prompt: String!, defaultText: String!, initiatedBy frame: WebFrame!) -> String!
```

## Parameters

- `sender`: The web view that sent the message.
- `prompt`: The message to display in the text input panel.
- `defaultText`: Default placeholder text to display in the text field.
- `frame`: The web frame whose JavaScript initiated this call.

## Return Value

Return Value The text entered by the user if the user clicks OK; otherwise, nil.

## Discussion

Discussion This method is used to provide an alternate text input panel when JavaScript code calls prompt. Delegates should visually indicate that this panel comes from JavaScript. The panel should contain an OK and a Cancel button, and an editable text field. If you do not implement this method, a JavaScript text input panel is displayed.

## See Also

### Opening Panels

- [webView(_:runJavaScriptAlertPanelWithMessage:initiatedBy:)](webkit/webuidelegate/webview(_:runjavascriptalertpanelwithmessage:initiatedby:).md)
- [webView(_:runJavaScriptConfirmPanelWithMessage:initiatedBy:)](webkit/webuidelegate/webview(_:runjavascriptconfirmpanelwithmessage:initiatedby:).md)
- [webView(_:runOpenPanelForFileButtonWith:)](webkit/webuidelegate/webview(_:runopenpanelforfilebuttonwith:).md)
- [webView(_:runOpenPanelForFileButtonWith:allowMultipleFiles:)](webkit/webuidelegate/webview(_:runopenpanelforfilebuttonwith:allowmultiplefiles:).md)
- [webView(_:runBeforeUnloadConfirmPanelWithMessage:initiatedBy:)](webkit/webuidelegate/webview(_:runbeforeunloadconfirmpanelwithmessage:initiatedby:).md)
