Search...
restoreElement( )
Restores (shows) a widget element on the stage.
Description
The restoreElement()
function returns a Promise that is resolved when the element is restored. You can only restore elements that are part of the widget with which the panel is associated.
The element selector is a string with the hash symbol (#
) followed by the ID of the item you want to select (for example, "#myElement"
). To use this function on an inner (nested) widget, use getScopedWixEditor()
.
Syntax
function restoreElement(selector: string): Promise<void>
restoreElement Parameters
NAME
TYPE
DESCRIPTION
selector
string
An element selector.
Returns
Fulfilled - when the element is restored.
Return Type:
Promise<void>
Related Content:
Was this helpful?
Show an element
Copy Code
1import wixEditor from 'wix-editor';23// ...45wixEditor.restoreElement('#title');
Use a toggle switch to remove/restore a widget element
Copy Code
1// In this example, we use a toggle switch to remove or restore an element in our widget.23import wixEditor from 'wix-editor';45$w.onReady(async function () {6 $w('#toggleSwitch').onClick(async (event) => {7 if (event.target.value) {8 await wixEditor.removeElement('#title');9 } else {10 await wixEditor.restoreElement('#title');11 }12 });13});