Trouble with closing lightbox after submiting email adress

Hi

I have tried the following code:
$w(“#MyData”).onAfterSave( () => {
console.log(“After save”);
wixWindow.lightbox.close();

It saves the email address but fails to close automatically after it has been submitted.
I am still new at this coding thing so I am probably missing something.

What are you actually trying to do within your lightbox?

Have you used your own code to create a login/signup lightbox?
If you have used code, then you need to be pasting whatever code you have on your post as well.

Have you used a pre-made form from within the Wix Editor that is from the Wix Forms app for Get Subscribers or something similar?