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.setTag(tag)
  • Syntax
  • Parameters
  • Returns
  • Example
  • Designer Ability
ElementsElement Types & MethodsDOM Elements

Set Tag

Was this page helpful?
Previous

Get All Attributes

Next
Built with

element.setTag(tag)

Set the value of the specified HTML tag of the DOMElement.

This method also works on other Webflow elements; see Set HTML tag.

Syntax

1element.setTag(tag: string): Promise<null>

Parameters

  • tag : string - The HTML tag to set for the element

Returns

Promise<null>

A promise that resolves to null

Example

1// Get Selected Element
2const selectedElement = await webflow.getSelectedElement();
3
4if (selectedElement?.children) {
5
6 // Create and append DOM Element
7 const DOMElement = await selectedElement.append(webflow.elementPresets.DOM);
8 console.log(DOMElement)
9
10 // Set Tag
11 await DOMElement?.setTag('img');
12 const tag = await DOMElement.getTag()
13 }

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canDesignPrimaryMainCanvasDesign