Get All Custom Attributes

element.getAllCustomAttributes()

Get all attributes on an element.

Previously, this method returned only the custom HTML attributes on an element, but now it returns all attributes.

This method is equivalent to the element.getAttributes() method.

Syntax

element.getAllCustomAttributes():Promise<Array<NamedValue>>

Returns

Promise<Array<NamedValue>> - [{name: string, value: string}]

A Promise that resolves to an array of NamedValue custom attribute objects.

Example

// Get Selected Element
const selectedElement = await webflow.getSelectedElement()
if (selectedElement?.customAttributes) {
// Get All Custom Attributes
const customAttributes = await selectedElement.getAllCustomAttributes()
console.log(customAttributes)
}

Designer Ability

Checks for authorization only

Designer AbilityLocaleBranchWorkflowSitemode
canAccessCanvasAnyAnyAnyAny