Set Tag

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

element.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

// Get Selected Element
const selectedElement = await webflow.getSelectedElement();
if (selectedElement?.children) {
// Create and append DOM Element
const DOMElement = await selectedElement.append(webflow.elementPresets.DOM);
console.log(DOMElement)
// Set Tag
await DOMElement?.setTag('img');
const tag = await DOMElement.getTag()
}

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canDesignPrimaryMainCanvasDesign