Remove Attribute

element.removeAttribute(name)

Remove the specified HTML attribute from the DOMElement. Use this method instead of the ‘Custom Attribute’ methods.

Syntax

element.removeAttribute(name: string): Promise<null>

Parameters

  • name : string - The name of the attribute to remove

Returns

Promise<null>

A promise that resolves to null

Example

// Get Selected Element
const selectedElement = await webflow.getSelectedElement();
if (selectedElement?.type === "DOM") {
// Get current attributes
const beforeAttributes = await selectedElement.getAllAttributes();
console.log('Before removal:', beforeAttributes);
// Remove an attribute
await selectedElement.removeAttribute('width');
// Get attributes after removal to verify
const afterAttributes = await selectedElement.getAllAttributes();
console.log('After removal:', afterAttributes);
}

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canDesignPrimaryMainCanvasDesign