> This page is for Designer API.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developers.webflow.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.webflow.com/_mcp/server.

# Get Text Content

> Get text content from an element.

The text content of an element is automatically created as a child `StringElement` of that element. To retrieve the text content from an element, you'll need to retrieve the child `StringElement` of your target element. Once you've retrieved the `StringElement` you can use the [`getText()`](/designer/reference/string-element/getText) method to get the text content of your element.

## Example

```typescript
// Get Selected Element
const selectedElement = await Webflow.getSelectedElement();

if (selectedElement?.textContent && selectedElement?.children) {

  // Get Child Elements
  const children = await selectedElement.getChildren();

  // Filter string elements from children
  const strings = children.filter(child => child.type === "String");

  // Initialize an array to hold text content
  let textContent = [];

  // Loop over string elements to get text
  for (const myString of strings) {
    if (myString.type === "String") {
      const text = await myString.getText();
      textContent.push(text);
    }
  }

  // Print text
  console.log(textContent);
}
```