The availability of features may depend on your plan type. Contact your Customer Success Manager if you have any questions.

Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideLegal TermsGitHubDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

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();