Remove attribute (Beta)

element.removeAttribute(name) / element.removeAttribute(index)

Remove a single attribute from an element.

You can identify the attribute to remove by its name string or by its zero-based index in the attributes array.

This method is equivalent to the element.removeCustomAttribute(name) method.

Beta

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

Syntax

1element.removeAttribute(name: string): Promise<null>
2element.removeAttribute(index: number): Promise<null>

Parameters

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

Returns

Promise<null>

A Promise that resolves to null.

Example

1const element = await webflow.getSelectedElement()
2
3if (element && element.attributes) {
4 // Remove by name
5 await element.removeAttribute('data-label')
6
7 // Remove by index
8 await element.removeAttribute(0)
9}

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canDesignPrimaryMainCanvasDesign