WebView.SelectedText
--------------------

Queries text of current selection.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [WebView](component_WebView.md) | [5.0](newinversion50.md) | ✅ Yes | ✅ Yes | ❌ No | ❌ No | ✅ Yes |

MBS( "WebView.SelectedText"; WebViewerRef { ; Formatted } ) 

**MBS**( **"WebView.SelectedText";** /\* Queries text of current selection. \*/  
**$WebViewerRef**; /\* Either the Web Viewer Object Name or the Web Viewer ID as returned by "[WebView.FindByName](WebViewFindByName.md)" function. \*/   
**$Formatted**) /\* Optional; Optional for Mac. If 1, tries to get text with formatting.e.g. 1 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| WebViewerRef | Either the Web Viewer Object Name or the Web Viewer ID as returned by "[WebView.FindByName](WebViewFindByName.md)" function. |  |  |
| Formatted | Optional for Mac. If 1, tries to get text with formatting. | 1 | Optional |

### Result

Returns text or error.

### Description

Queries text of current selection.  
If you put this in a button, the focus may leave WebViewer and selection is lost. In a menu it works better.  
  
See also [WebView.GetPlainText](WebViewGetPlainText.md), [WebView.GetHTMLText](WebViewGetHTMLText.md) and [WebView.GetFormattedText](WebViewGetFormattedText.md).  
### Examples

Query plain text from WebViewer:

 MBS ("[WebView.GetPlainText](WebViewGetPlainText.md)"; "web")  
Query html text from WebViewer:

 MBS ("[WebView.GetHTMLText](WebViewGetHTMLText.md)"; "web")  
Query formatted text from WebViewer:

 MBS ("[WebView.GetFormattedText](WebViewGetFormattedText.md)"; "web")  
Query selected text:

 MBS ("WebView.SelectedText"; "web")  
### See also

- [WebView.FindByName](WebViewFindByName.md)
- [WebView.GetForm](WebViewGetForm.md)
- [WebView.GetFormattedText](WebViewGetFormattedText.md)
- [WebView.GetHTMLText](WebViewGetHTMLText.md)
- [WebView.GetPlainText](WebViewGetPlainText.md)
- [WebView.SearchText](WebViewSearchText.md)

### Example Databases

- [WebViewer/WebView Selected Text](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/WebViewer/WebView%20Selected%20Text.shtml#2ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 5.0pr11](https://www.mbsplugins.de/archive/2015-02-13/MBS_FileMaker_Plugin_version_5/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 5.0pr9](https://www.mbsplugins.de/archive/2015-02-01/MBS_FileMaker_Plugin_version_5/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 28th January 2015 , last changed 4th November 2021

  
[WebView.SelectAll](WebViewSelectAll.md) - [WebView.SendCommand](WebViewSendCommand.md)

[HTML Version](WebViewSelectedText.shtml)