Search.../

delete( )

Deletes an element from the DOM. This is a temporary deletion. Use restore to restore the deleted element.

SEO crawlers cannot find content in an element whose deleted status is true. Content in an element that is in hidden status can be found by crawlers.

Note: An element whose deleted status is true can be edited.

Description

The delete() function returns a Promise that is resolved when the element's deleted property has been set to true.

Syntax

function delete(): Promise<void>

delete Parameters

This function does not take any parameters.

Returns

Fulfilled - When the element's deleted property has been set to true.

Return Type:

Promise<void>
Mixed in from:$w.Element

Was this helpful?

Delete an element from the DOM

Copy Code
1$w("#myElement").delete();
Delete an element from the DOM and log a message when done

Copy Code
1$w("#myElement").delete()
2 .then( () => {
3 console.log("Done with delete");
4 } );