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
        • Get HTML tag
        • Set HTML tag
      • Attributes
      • Custom Attributes
      • Styles
      • Text Content
      • Display Name
    • Element Types & Methods
  • 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 Properties & MethodsTags

Get HTML tag

Was this page helpful?
Previous

Set HTML tag

Next
Built with

element.getTag()

Retrieve the HTML tag of an element.

Syntax

1element.getTag(): Promise<null | BlockElementTag | HeadingTag | ListTag>

This method also returns the binding metadata for Heading elements:

1// Heading elements only — returns binding metadata when tag is bound to a CMS field
2element.getTag(options: { bindings: true }): Promise<HeadingTag | BindingValue | null>

Returns

The return type depends on the element type:

Element typeReturn typeValid tag values
Block, Section, VFlex, HFlex, Container, Row, Column, BlockContainer, RichText, Slot, NavbarContainer, TabsContentBlockElementTag | nulldiv, header, footer, nav, main, section, article, aside, address, figure
HeadingHeadingTag | nullh1, h2, h3, h4, h5, h6
ListListTag | nullul, ol

Returns null if the element is not found or the tag is not set.

Example

1const el = await webflow.getSelectedElement();
2
3if (el?.type === 'Block') {
4 const tag = await el.getTag(); // BlockElementTag | null
5 console.log(tag); // e.g. 'section'
6}
7
8if (el?.type === 'Heading') {
9 const tag = await el.getTag(); // HeadingTag | null
10 console.log(tag); // e.g. 'h2'
11}
12
13if (el?.type === 'List') {
14 const tag = await el.getTag(); // ListTag | null
15 console.log(tag); // 'ul' or 'ol'
16}

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canAccessCanvasAnyAnyAnyAny