element.setTag(tag)

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

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