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
ReferenceGuidesExamplesChangelog
  • Designer API
    • Introduction
    • Getting Started
    • Webflow CLI
    • Error Handling
    • App Modes
  • Elements
    • Creating & Retrieving Elements
    • Element Properties & Methods
    • Element Types & Methods
      • Element Presets
      • DOM Elements
      • Strings
      • Components
      • Slots
      • Headings
      • Images
        • Get Asset
        • Set Asset
        • Get Alt Text
        • Set Alt Text
      • Links
      • Forms
  • 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
LogoLogo
Resources
Get started
On this page
  • element.setAltText(altText)
  • Syntax
  • Parameters
  • Returns
  • Example
  • Designer Ability
ElementsElement Types & MethodsImages

Set Alt Text

Was this page helpful?
Previous

Link Element

Next
Built with

element.setAltText(altText)

Set the Alt Text for an Image element on the canvas.

Syntax

1element.setAltText(altText: string | null): Promise<null>

Parameters

  • alt text: string - The alternate text for an image

Returns

Promise<null>

A Promise that resolves to null

Example

1// Get Selected Element
2const el = await webflow.getSelectedElement()
3
4// Check element type
5if (el?.type === 'Image') {
6 // Set alt text
7 await el.setAltText('Descriptive alternative text for this image')
8
9 // Verify by getting the alt text
10 const alt = await el.getAltText()
11 console.log(alt)
12} else {
13 console.error('Please select an image element')
14 await webflow.notify({
15 type: 'Error',
16 message: 'Please select an Image Element',
17 })
18}

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canModifyImageElementanymaincanvasany