Set Div Block element tag

element.setTag()

Set the element tag of a Div Block element, which helps assistive technologies and search engines understand the page structure and hierarchy.

Syntax

1element.setTag(tag: BlockElementTag): Promise<null>

Parameters

  • tag: BlockElementTag - A valid Block element tag, including div, header, footer, nav, main, section, article, aside, address, or figure

Returns

Promise<null>

A Promise that resolves to null.

Example

1// Get a Div Block element
2const el = await webflow.getSelectedElement();
3
4// Set its element tag to main
5if (el.type === 'Block') {
6 // Get the current element tag
7 const elementTag = await el.getTag();
8 if (elementTag !== 'main') {
9 // Set the element tag
10 await el.setTag('main');
11 }
12}

Designer Ability

Checks for authorization only

Designer AbilityLocaleBranchWorkflowSitemode
canAccessCanvasAnyAnyAnyAny