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
      • Attributes
        • Get Attributes
        • Get Resolved Attributes
        • Set Attributes
        • Set Attribute
        • Get Attribute Value
        • Get Resolved Attribute Value
        • Remove Attribute
      • Custom Attributes
      • Styles
      • 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
LogoLogo
Resources
Get started
On this page
  • element.getAttributeValue(name) / element.getAttributeValue(index)
  • Syntax
  • Parameters
  • Returns
  • Example
  • Designer Ability
ElementsElement Properties & MethodsAttributes

Get attribute value (Beta)

Was this page helpful?
Previous

Get resolved attribute value (Beta)

Next
Built with

element.getAttributeValue(name) / element.getAttributeValue(index)

Get the value of a single attribute on an element.

You can look up the attribute by its name string or by its zero-based index in the attributes array. The returned value may be a plain string or a BindingValue when the attribute value is bound to a variable or component prop.

To get the resolved string value with any binding evaluated, use element.getResolvedAttributeValue().

Beta

These methods are in public beta and may change with future releases.

Syntax

1element.getAttributeValue(name: string): Promise<string | BindingValue | null>
2element.getAttributeValue(index: number): Promise<string | BindingValue | null>

Parameters

  • name : string — The name of the attribute whose value to retrieve.
  • index : number — The zero-based position of the attribute in the element’s attributes array.

Returns

Promise<string | BindingValue | null>

A Promise that resolves to the attribute value, a BindingValue if the value is a binding reference, or null if no attribute with the given name or index exists.

Example

1const element = await webflow.getSelectedElement()
2
3if (element && element.attributes) {
4 // Look up by name
5 const value = await element.getAttributeValue('data-label')
6 console.log(value) // 'primary'
7
8 // Look up by index
9 const first = await element.getAttributeValue(0)
10 console.log(first) // 'primary'
11}

Try this example

Designer Ability

Checks for authorization only.

Designer AbilityLocaleBranchWorkflowSitemode
canAccessCanvasAnyAnyAnyAny