---
title: selectedAttributedString()
framework: webkit
role: symbol
role_heading: Instance Method
path: webkit/webdocumenttext/selectedattributedstring()
---

# selectedAttributedString()

Returns the currently selected text in the web document as an attributed string.

## Declaration

```swift
func selectedAttributedString() -> NSAttributedString!
```

## Return Value

Return Value An attributed string containing the currently selected text in the web document.

## See Also

### Selecting and deselecting text

- [selectAll()](webkit/webdocumenttext/selectall().md)
- [deselectAll()](webkit/webdocumenttext/deselectall().md)
- [selectedString()](webkit/webdocumenttext/selectedstring().md)
