Designer API
Control the Webflow Designer
element.removeAttribute(name)
Remove the specified HTML attribute from the DOMElement. Use this method instead of the ‘Custom Attribute’ methods.
1element.removeAttribute(name: string): Promise<null>
string
Promise<null>
null
A promise that resolves to null
1// Get Selected Element2const selectedElement = await webflow.getSelectedElement();34if (selectedElement?.type === "DOM") {5 // Get current attributes6 const beforeAttributes = await selectedElement.getAllAttributes();7 console.log('Before removal:', beforeAttributes);89 // Remove an attribute10 await selectedElement.removeAttribute('width');1112 // Get attributes after removal to verify13 const afterAttributes = await selectedElement.getAllAttributes();14 console.log('After removal:', afterAttributes);15}