---
title: "Selection.text() | Grafana k6 documentation"
description: "Get the text content of the Selection."
---

# Selection.text()

Get the text content of the Selection. Mimics [jquery.text](https://api.jquery.com/text/).

### Returns

Expand table

| Type   | Description             |
|--------|-------------------------|
| string | Selection text content. |

### Example

JavaScript ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```javascript
import { parseHTML } from 'k6/html';
import http from 'k6/http';

export default function () {
  const res = http.get('https://k6.io');
  const doc = parseHTML(res.body);
  const pageTitle = doc.find('head title').text();
}
```
