For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Resources
Get started
ReferenceGuidesExamplesChangelog
ReferenceGuidesExamplesChangelog
  • Designer API
    • Introduction
    • Getting Started
    • Webflow CLI
    • Error Handling
    • App Modes
  • Elements
    • Creating & Retrieving Elements
    • Element Properties & Methods
    • Element Types & Methods
      • Element Presets
      • DOM Elements
        • Get HTML Tag
        • Set HTML Tag
        • Get All Attributes
        • Get Attribute
        • Set Attribute
        • Remove Attribute
      • Strings
      • Components
      • Slots
      • Headings
      • Images
      • Links
      • Forms
  • Styles
    • Managing Style Properties
    • Managing Variable Modes
  • Components
  • Variables & Collections
    • Variable Collections
    • Variables
    • Variable Modes
  • Assets
  • Pages & Folders
  • Utilities
    • User Events & Notifications
    • App Intents & Connections
  • Additional Resources
    • API Playground
    • FAQs
LogoLogo
Resources
Get started
On this page
  • element.removeAttribute(name)
  • Syntax
  • Parameters
  • Returns
  • Example
  • Designer Ability
ElementsElement Types & MethodsDOM Elements

Remove Attribute

Was this page helpful?
Previous

String Element

Next
Built with

element.removeAttribute(name)

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

Syntax

1element.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

1// Get Selected Element
2const selectedElement = await webflow.getSelectedElement();
3
4if (selectedElement?.type === "DOM") {
5 // Get current attributes
6 const beforeAttributes = await selectedElement.getAllAttributes();
7 console.log('Before removal:', beforeAttributes);
8
9 // Remove an attribute
10 await selectedElement.removeAttribute('width');
11
12 // Get attributes after removal to verify
13 const afterAttributes = await selectedElement.getAllAttributes();
14 console.log('After removal:', afterAttributes);
15}

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canDesignPrimaryMainCanvasDesign