For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Resources
Get started
ReferenceGuidesExamplesChangelog
LogoLogo
ReferenceGuidesExamplesChangelog
  • Designer API
    • Introduction
    • Getting Started
    • Webflow CLI
    • Error Handling
    • App Modes
  • Elements
    • Creating & Retrieving Elements
    • Element Properties & Methods
      • Attributes
      • Custom Attributes
      • Styles
      • Text Content
        • Set Text Content
        • Get Text Content
      • Display Name
    • Element Types & Methods
  • Styles
    • Managing Style Properties
    • Managing Variable Modes
  • Components
  • Variables & Collections
    • Variable Collections
    • Variables
    • Variable Modes
  • Assets
  • Pages & Folders
  • Utilities
    • User Events & Notifications
    • App Intents & Connections
  • Additional Resources
    • API Playground
    • FAQs
Resources
Get started
On this page
  • element.setTextContent(content)
  • Syntax
  • Parameters
  • Returns
  • Example
  • Designer Ability
ElementsElement Properties & MethodsText Content

Set Text Content

Was this page helpful?
Previous

Get Text Content

Next
Built with

element.setTextContent(content)

Set text content for an element that supports text content.

Syntax

1element.setTextContent(content: string): Promise<null>>

Parameters

  • content: string - Text to add to the element

Returns

Promise<null>

A Promise that resolves to null.

Example

1// Get Selected Element
2const selectedElement = await Webflow.getSelectedElement()
3
4if (selectedElement?.textContent) {
5
6 // Set and print text content
7 const text = await selectedElement.setTextContent("Lorem Ipsum")
8 console.log(selectedElement.textContent)
9
10}

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canEditAnyAnyCanvasAny