Get selected element
webflow.getSelectedElement()
Retrieve the element that the user has selected in the Webflow Designer.
The returned element object provides access to all element properties (like type
, id
, and styles
) and exposes methods such as getChildren()
, getStyles()
, and getCustomAttributes()
for working with the element programmatically.
Syntax
Returns
Promise<AnyElement
| null
>
A Promise that resolves to one of the following:
AnyElement
: An object that represents the various element types available in a Webflow project. See a full list of supported element types in the Designer Extension type definitions.null
: If an element is not currently selected in the Designer
Example