Reset JS
This topic describes the Reset JS code section of the Extension Builder.
Reset JS is used to "clean up" after an extension. It is used in the editor when changing field values or removing an existing extension. Reset JS should remove the element and any other side effects.
One way to write reset JS is to use the extension.$instance
value. For example, you could create an extension with HTML starting like this:
<div class="banner" data-extension-instance="{{extension.$instance}}">
Then remove it using Reset JS:
$("[data-extension-instance=" + extension.$instance + "]").remove();
Updated almost 2 years ago