Search.../

parent

Gets the element's parent element.

Description

Some elements can contain other elements. This occurs when you drag an element onto a container element. The container is the parent of all the elements it contains.

Page, Header, and Footer are top-level elements and have no parent.

Type:

NodeRead Only, default value is null
Mixed in from:$w.Element

Related Content:

Was this helpful?

Get the parent element and the parent's ID

Code Example

Copy Code
1let parentElement = $w("#myElement").parent;
2
3let parentId = parentElement.id; // "page1"