element.getTag()

Retrieve the HTML tag of the element.

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
Built with