Get HTML tag
element.getTag()
Retrieve the HTML tag of an element.
Syntax
This method also returns the binding metadata for Heading elements:
Returns
The return type depends on the element type:
Returns null if the element is not found or the tag is not set.
The element type doesn't tell you the HTML tag
Box elements have the element type Block, the same type as a Div Block.
A Block element can use any of the tags in the table above, so check element.type to narrow the type, then call getTag() to read the tag.
Other layout types, such as Section, Container, Row, and VFlex, can still appear in existing content.
The deprecated Grid, Row, HFlex, VFlex, and BlockContainer presets also still create elements of their own types.
Grid elements don’t have a getTag() method.