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

Get Tag

Was this page helpful?
Previous

Set Tag

Next
Built with

element.getTag()

Retrieve the HTML tag of the element.

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

Syntax

1element.getTag(): Promise<null | string>

Returns

  • Promise<String> : If the element has a tag, a promise that resolves to the tag value.
  • Promise<null>: If the element does not have a tag, a promise that resolves to null

Example

1// Get All Elements and find first DOM Element
2const elements = await webflow.getAllElements()
3const DOMElement = elements.find(element => element.type === "DOM")
4
5if (DOMElement?.type === "DOM") {
6
7 // Get DOM Element's Tag
8 const tag = await DOMElement.getTag()
9 console.log(tag)
10
11} else {
12 console.log('No DOM Element Found')
13}

Designer Ability

Checks for authorization only

Designer AbilityLocaleBranchWorkflowSitemode
canAccessCanvasAnyAnyAnyAny