element.getCustomAttribute(name)

Get custom HTML attributes for an element by name.

Syntax

1element.getCustomAttribute(name: string):Promise<null | string>

Parameters

  • name : String - The name of the custom attribute.

Returns

Promise<String>

A Promise that resolves to the value of the named custom attribute.

Example

1// Get Selected Element
2const selectedElement = await webflow.getSelectedElement()
3
4if (selectedElement?.customAttributes) {
5
6 // Get Custom Attribute by Name
7 const customAttribute = await selectedElement.getCustomAttribute('tooltip')
8 console.log(customAttribute)
9
10}

Designer Ability

Checks for authorization only

Designer AbilityLocaleBranchWorkflowSitemode
canAccessCanvasAnyAnyAnyAny
Built with